Skip to main content
The API uses standard HTTP status codes. Every error body is JSON with a detail field you can show to a person:
Some errors also carry an X-Error-Code response header with a stable, machine-readable code. Branch on that header, never on the detail text, which can change.

Status codes

Validation errors

A 422 lists every invalid field, so you can fix them all at once:
loc gives where the problem is (query, path or body) and the field name.

Error codes

Retry strategy

429 and 5xx. Wait for Retry-After when present, otherwise back off exponentially (1 s, 2 s, 4 s…) and give up after a few attempts.
400, 401, 403, 404, 409 and 422. The same request will fail again until you change it, the key, or the account.
If a POST times out, read the resource back before sending it again. Creating a prompt or launching an audit twice spends quota twice.