Skip to main content
All Relayer API errors follow a consistent response envelope. This page covers the error format, HTTP status codes, common business errors, and how to handle them.

Error response format

Every error response uses the same envelope as successful responses, with success: false:
Some agent endpoints add structured error codes inside the body for client-side dispatch — see Agent-specific errors below.

HTTP status codes

4xx — client errors

5xx — server errors

2xx with caveats

Authentication errors

Fix: Add the Authorization: ApiKey rk_... header to your request.

Agent-specific errors

Agent endpoints use structured error codes inside the body so the SDK can dispatch programmatically:

Validation errors

400 responses include the specific field and constraint that failed in message:
For requests with multiple validation failures, message typically lists the first offending field. Check your request payload against the schema in the API Reference.

Common business errors

422 Unprocessable Entity is returned when a request is well-formed but conflicts with business rules:

Error handling patterns

1

Check the status code first

4xx errors are your responsibility — inspect the message and fix the request. 5xx errors are server-side — retry with backoff.
2

Read the message field

The message is human-readable and explains the specific problem. Log it for debugging and surface a user-appropriate message in your UI.
3

Handle 401 and 403 separately

401 means unauthenticated (missing or invalid credentials). 403 means authenticated but not authorized (scope or permissions issue). These require different resolution paths.
4

Retry 429 and 5xx with backoff

Rate limit (429) and server errors (502, 503) are transient. Retry with exponential backoff: 1s, 2s, 4s, 8s. Give up after 3-4 attempts and surface the error to the user.
5

Treat 202 as 'pending', not an error

A 202 response means the action was accepted but is awaiting human approval (signing flows) or polling resolution (agent x402). It’s not a failure — poll the relevant resource until you get a final state.

Getting help

If you encounter a persistent 500 error or unexpected behavior, contact dev@relayer.fi with:
  • The full error response body
  • The request path, method, and (sanitized) payload
  • Your API key prefix (first 20 characters only — never share the full key)
  • The timestamp from the error envelope (we use it to locate server-side logs)