Errors¶
Non-2xx responses use a stable envelope:
{
"error": {
"type": "authorization_error",
"code": "insufficient_scope",
"message": "This endpoint requires the \"write:posts\" scope, which this key does not have.",
"request_id": "req_…"
}
}
codeis the precise, machine-stable reason — branch on this.typeis the broad category, for clients that only need to know what kind of thing went wrong.messageis human-readable and may change; don’t parse it.request_idechoes theX-Request-Idheader. Quote it when contacting support.
Codes¶
|
|
HTTP status |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
An unrecognised code always maps to api_error / 500, so a client that handles the categories above degrades safely if we add a code.
Note
Generated from lib/api/errors.ts by pnpm docs:api.