Errors
Errors
The V1 API error envelope, how to handle it, and the full machine-readable error-code catalog.
Every V1 API error returns a consistent JSON envelope. Branch your integration on
the stable error.code — never parse the human-readable error.message, which is
not a contract and may change.
Error envelope
{
"error": {
"code": "scope_insufficient",
"message": "The token is missing a required scope.",
"requestId": "req_a1b2c3d4",
"timestamp": "2026-06-21T10:32:00.000Z",
"details": [{ "field": "scope", "message": "tasks:write required" }]
}
}| Field | Notes |
|---|---|
code | Stable, machine-readable. One of the values in the Error Catalog. |
message | Human-readable, may change — do not branch on it. |
requestId | Correlate with your logs and with support; include it when reporting an issue. |
timestamp | ISO-8601 UTC. |
details | Optional, present for validation errors — per-field messages. |
Handling errors
- Read the HTTP status for the broad class (
4xxclient,5xxserver). - Switch on
error.codefor precise handling (e.g. refresh onunauthorized, back off onrate_limit_exceeded, request the missing scope onscope_insufficient). - Log
requestIdso support can trace the exact request.
The exception filter clamps every emitted code to the catalog: a code that is
not yet enumerated falls back to its status-map generic (e.g. bad_request), so you
can always rely on the code being one of the catalogued values.
Full catalog
The complete, always-current list — code, HTTP status, and category — is generated
from the @emofy/types error-code SSOT: