Error classification
Always classify errors by HTTP status code first. The response body provides additional context but should not be used as the primary decision point.| Status | Kind | Meaning | Retryable? |
|---|---|---|---|
400 | Validation | Request body or query parameters failed validation | No — fix the request |
401 | Auth | Missing, expired, or invalid bearer token | No — re-authenticate |
403 | Forbidden | Valid token but insufficient permissions | No — check your application scope |
404 | Not found | Resource doesn’t exist or isn’t visible to your application | No |
409 | Conflict | Concurrent modification, duplicate key, or consumed OTP | No — check state and retry if appropriate |
422 | Validation | Body parsed but semantics are invalid | No — fix the request |
429 | Rate limited | Too many requests | Yes — back off and retry |
5xx | Server error | Server or upstream failure | Yes — retry idempotent requests with backoff |
Error response shape
Error responses follow the same standard envelope as success responses, withdata set to null:
| Field | Description |
|---|---|
data | Always null for errors |
status | The HTTP status code — matches the status on the wire |
message | "code: description" — the code prefix is the stable, machine-readable error identifier; the description is a human-readable explanation |
X-Request-Id header is always present on error responses. Include it in support tickets.
Handling errors in code
Request IDs
Every response (including errors) includes anX-Request-Id header. Always capture and log this value:
- Include it in error logs for debugging
- Surface it in user-facing error messages
- Send it to Zeam support when filing a ticket
Retry strategy
For retryable errors (429, 5xx):
- Read the
Retry-Afterheader if present - Use exponential backoff with jitter (e.g., 1s, 2s, 4s, 8s)
- Set a maximum retry count (e.g., 3-5 attempts)
- Only retry idempotent requests (
GET,PUT,DELETE) automatically - For non-idempotent
POSTrequests, check the response or use an idempotency key before retrying

