Skip to main content
When a request fails, the API returns a non-2xx status code and a JSON body with a consistent envelope.

Error envelope

error.code
string
A stable, machine-readable code. Branch on this rather than on message.
error.message
string
A human-readable description of the failure. May change; not for branching.
error.details
array
Optional. Field-level validation details, each with a field and message, present on some VALIDATION_ERROR responses.
error.trace_id
string
Optional. An identifier for the failed request, included on server-side errors (5xx). Quote it when reporting an issue.

Status codes

Handling errors

  • Always check the status code before reading a success body.
  • Branch on error.code, not on the human-readable error.message.
  • Retry 502 with backoff; do not retry 400, 401, or 402 without fixing the request first (top up your credit balance to clear a 402).