Requests and responses
JSON error envelope
Errors always return { error: { code, message, retryable } }.
Overview
Failures use a single top-level error object. CORS failures and unknown routes still follow this shape when the Cloud API handles them.
json
{
"error": {
"code": "invalid_argument",
"message": "Human-readable message",
"retryable": false
}
}| Field | Required | Description |
|---|---|---|
| code | Yes | Stable machine code — branch on this in app logic |
| message | Yes | Human-readable text. It may be replaced with a generic message, so do not parse it. |
| retryable | Yes | Hint: safe to retry with backoff when true |
Handling tip
Never parse message for control flow. Messages can change or be replaced with generic public strings. Use code and retryable. Details: Error object shape.
Errors use HTTP { "error": { "code", "message", "retryable" } }. Branch on code, not the message text.
| Code | HTTP | When |
|---|---|---|
| unauthorized | 401 | Missing or invalid credentials |
| invalid_argument | 400 | Bad query, body, or chain id |
| credits_exhausted | 402 | The organization has used its credit allowance |
| plan_feature_denied | 403 | Your plan does not include this feature |
| rate_limit_exceeded | 429 | Throttle — honor retryable and backoff (retryable) |
json
{
"error": {
"code": "unauthorized",
"message": "Human-readable detail (may be sanitized).",
"retryable": false
}
}