Skip to main content
Every API error returns the same JSON shape, so you can handle all of them the same way: check the status code, read the stable error.code, and branch on it. The human message is for display and logging only — never parse it, because the wording can change.

The error object

Request IDs

Every response — success or error — includes an X-Request-Id header (for example req_4f3c…). On errors it’s also in the body as error.request_id. Log it on your side, and include it when you contact support so we can find the exact request fast.

Catch errors

Check for a non-2xx status, read error.code, and decide what to do.

Error types

type groups errors by what generally went wrong, so you can pick a broad response without listing every code. For the specific reason, use code.

Handle rate limits

When you get rate_limit_exceeded (429), wait and retry. Prefer the Retry-After header when it’s present; otherwise back off exponentially.

Handle transient errors

internal_error (500) and UPSTREAM_PROVIDER_ERROR (502) are usually temporary and not a problem with your request. Retry with exponential backoff. For writes, retry the same request rather than creating a new one, so you don’t duplicate work. For anything in the invalid_request_error family, do not blindly retry — the request needs to change first. Use code and param to fix it.

Next steps

See the full Error codes reference for every code, what it means, and how to resolve it. Each error’s doc_url links straight to its entry there.