Every error on every operation uses one envelope. Branch on the machine-readable code, show your users something better than the raw message, and quote the requestId when you talk to us.
{
"error": {
"code": "DOMAIN_RULE",
"message": "This class is full.",
"details": {
"capacity": 12
},
"requestId": "req_2f3a9c81d4b7"
}
}code is stable and machine-readable. New codes may be added; existing codes will not change meaning.message is human-readable and may change wording at any time. Never branch on it.details is optional structured context for some codes.requestId identifies this exact request in our logs. It is also returned on every response, success included, in the x-request-id header.| Code | Status | Meaning |
|---|---|---|
VALIDATION_ERROR | 400 | The request shape failed validation. The message says which field. |
IDEMPOTENCY_KEY_REQUIRED | 400 | The operation requires an Idempotency-Key header and none was sent. |
UNAUTHENTICATED | 401 | Missing or invalid Bearer token. |
FORBIDDEN | 403 | The token is valid but lacks the required scope or store access. |
NOT_FOUND | 404 | The resource does not exist or is not visible to this caller. |
CONFLICT | 409 | The write conflicts with the current state of the resource. |
DOMAIN_RULE | 422 | The request is well-formed but a business rule rejected it. |
IDEMPOTENCY_KEY_REUSED | 422 | The same Idempotency-Key was reused with a different request body. |
RATE_LIMITED | 429 | Too many requests. Honour the Retry-After header. |
INTERNAL | 500 | Something failed on our side. Safe to retry idempotent requests. |
DOWNSTREAM_UNAVAILABLE | 503 | A dependency (for example the payment provider) is unavailable. |
RATE_LIMITER_UNAVAILABLE | 503 | The rate limiter is unavailable and the operation fails closed. Retry after the Retry-After delay. |
Some operations return their own specific codes for business-rule rejections, always with a 4xx status and always in the same envelope. Treat any unrecognised code the way you treat DOMAIN_RULE: the request was understood and refused, so do not retry it unchanged.
429, which asks you to wait.Idempotency-Key, see the idempotency guide.Retry-After whenever it is present (on 429 and some 503 responses).