The envelope
Every error (except429, noted below) uses one JSON shape:
- Switch on
error.code, never onmessagetext — messages can change. error.detailscarries structured context and is included in non-production environments.- Log
requestId— include it when contacting support and we can trace the exact request.
Error codes
The
429 response uses a flat body — { "error": "Too many requests", "message": "..." } — rather than the envelope. Match on the status code.Ownership returns 404, not 403
Fetching a checkout, order, deposit, or refund that belongs to another account returns404 NOT_FOUND — identical to a nonexistent id. This is deliberate: foreign ids do not leak existence. If you see unexpected 404s, verify you are querying the right surface (/b2b orders are invisible to /retailer/v1 endpoints and vice versa).