2xx status code and a JSON body
with a consistent envelope.
Error envelope
A stable, machine-readable code. Branch on this rather than on
message.A human-readable description of the failure. May change; not for branching.
Optional. Field-level validation details, each with a
field and message,
present on some VALIDATION_ERROR responses.Optional. An identifier for the failed request, included on server-side
errors (
5xx). Quote it when reporting an issue.Status codes
Handling errors
- Always check the status code before reading a success body.
- Branch on
error.code, not on the human-readableerror.message. - Retry
502with backoff; do not retry400,401, or402without fixing the request first (top up your credit balance to clear a402).

