Error shapes
There are three shapes. Read the status first, then the body. 1.detail is a string (most errors).
detail is an object with a stable code (match on code, not on the message).
code and message at the top level, with no detail. These come from the edge rate limiter, the unknown-route handler and the catch-all for unexpected errors.
detail, one entry per bad field:
loc says where: ["body", "reference"] for a JSON body, ["query", "environment"] or ["path", "key"]. For a multipart form field the first item is body as well. Handle all three shapes: a client that assumes detail is always an object will fail on the first 422.
Request id
Every response carriesX-Request-ID. If you send your own (1 to 64 characters of A-Z a-z 0-9 . _ : -) Sahl returns it; otherwise Sahl creates one. Each key call is listed in Developers, Call log in the console under that id. Quote it when you write to Sahl.
Catalogue
The same codes, with their status, meaning, whether a retry can succeed and which routes answer with them, are served as JSON byGET /v1/partner/errors (see Account, usage and errors). Fetch it rather than hard-coding a list.
400 Bad request
401 Unauthorized
403 Forbidden
403 on the partner document APIs
These apply to/v1/kyb, /v1/statements, /v1/requests, /v1/partner/registry, /v1/partner/scoring and /v1/partner/policy when you ask for production. The body is {"detail": {"code": ..., "message": ...}}.
404 Not found
409 Conflict
410 Gone
413 Payload too large
422 Unprocessable
A bad
kind is not an error: unknown values count as individual.
429 Too many requests
Every response from the edge limiter also carries
X-RateLimit-Limit and X-RateLimit-Remaining. Calls with an API key are counted per key. Console calls without a key are counted per client IP, at 100 a minute. These numbers are the defaults in the code and can change.
500 and 502
A reader that cannot be reached is not an error on
/v1/kyc/extract in Production: it answers 200 with reader_unavailable: true. See Read documents.
Retries
The API has no idempotency key, except that document requests are idempotent perreference. Think about each call before you retry it.
Rules of thumb:
- Never retry a 4xx, except a 429 for
rate_limit_exceededorsandbox_daily_cap_reached, which haveRetry-After. A 4xx will fail the same way. - Retry a 5xx and a network timeout with exponential backoff and a cap, for example 2 s, 4 s, 8 s, then stop.
- Set a client timeout well above the usual answer time. The examples use 120 seconds for
/extract. - After a timeout on
/extractyou do not know whether the read ran. Check Documents for thereferencebefore you resend, or accept the duplicate.