GuidesErrors

Errors

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.

The envelope

Error response
{
  "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.

Canonical codes

CodeStatusMeaning
VALIDATION_ERROR400The request shape failed validation. The message says which field.
IDEMPOTENCY_KEY_REQUIRED400The operation requires an Idempotency-Key header and none was sent.
UNAUTHENTICATED401Missing or invalid Bearer token.
FORBIDDEN403The token is valid but lacks the required scope or store access.
NOT_FOUND404The resource does not exist or is not visible to this caller.
CONFLICT409The write conflicts with the current state of the resource.
DOMAIN_RULE422The request is well-formed but a business rule rejected it.
IDEMPOTENCY_KEY_REUSED422The same Idempotency-Key was reused with a different request body.
RATE_LIMITED429Too many requests. Honour the Retry-After header.
INTERNAL500Something failed on our side. Safe to retry idempotent requests.
DOWNSTREAM_UNAVAILABLE503A dependency (for example the payment provider) is unavailable.
RATE_LIMITER_UNAVAILABLE503The rate limiter is unavailable and the operation fails closed. Retry after the Retry-After delay.

Domain codes

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.

Handling errors well

  • 4xx: fix the request. Retrying the same request gives the same answer, except 429, which asks you to wait.
  • 5xx: retry with backoff. Writes are safe to retry when you send an Idempotency-Key, see the idempotency guide.
  • Honour Retry-After whenever it is present (on 429 and some 503 responses).
WhatsApp
Book a Call
Start Free