Error format
detailis usually a stable code in lowercase with underscores, such asagent_not_foundorcontact_list_not_found. Match on the code, not on the HTTP reason phrase.- A few authentication errors carry a short text in
detail, such asInvalid or expired API key. - Errors raised before a request reaches the API can add a human-readable
message. - For
422,detailis usually a list of field errors, each withloc(where the problem is),msgandtype. Some refusals return a string code instead, and a few return an object with acode. Handle all three shapes.
Status codes
Each operation in the reference lists the
404, 409 and 5xx responses it can return.
Permanent document deletion
404, 412 and 428 from the permanent document deletion do not use detail. They return {"error_code": "...", "preview": {...}}, where error_code is resource_not_found, deletion_preview_changed (412) or if_match_required (428). A 412 returns the fresh preview and its ETag header, so you can show the change and retry with the new ETag without requesting another preview.
Credential errors
These401 codes come with a message:
An unknown or deleted key answers
401 with detail set to Invalid or expired API key. The text is literal: keys do not expire.
Rate limit and availability codes
429withdetailrate_limited: slow down and retry after the number of seconds in theRetry-Afterheader.503: a dependency the request needs is temporarily unavailable, anddetailnames it, for examplerate_limit_unavailable(the API could not count your request) orcontacts_unavailable. Retry with backoff.
Retrying
- Retry
429and503(and other5xxon read operations) with exponential backoff and jitter, honoringRetry-Afterwhen present. - Do not retry other
4xxerrors without changing the request. They will fail again. - Creating operations are not idempotent: a retried
POSTcan create a second resource. After a timeout, list the resource to check whether the first request succeeded.