Errors
Handle API errors: the error envelope, every error code with its HTTP status, which ones to retry, and the codes of a task that fails while running.
A request that fails answers with an HTTP status and a stable code. A task that fails while running is different: the request succeeded, and the task ends with status FAILED.
The error envelope
JSON
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "request validation failed",
"details": [{ "path": "payload.prompt", "message": "Too small: expected string to have >=1 characters" }],
"timestamp": "2026-11-21T12:00:00.000Z",
"requestId": "req_5f0c9e2b7a4d4c1e9b8a6f3d2c1b0a99"
}
}codeis stable: branch on it, not onmessage.details.reasonrefines some codes.- Every response carries
X-Request-Id. Send your own to correlate. Quote it when you report a problem. - Unknown
/v1paths answer404and wrong methods405, in the same envelope.
Request errors
| Code | HTTP | Meaning |
|---|---|---|
VALIDATION_ERROR | 400 | The body or a parameter is invalid. details lists each field. |
MISSING_API_KEY | 401 | No API key. Send it as X-API-Key or as Authorization: Bearer. |
INVALID_API_KEY | 401 | The key is unknown or revoked. |
INSUFFICIENT_CREDITS | 402 | Not enough available credits, or the key reached its daily limit (details.reason daily_key_limit). |
PLAN_REQUIRED | 402 | |
FORBIDDEN | 403 | The request is not allowed: a read-only OAuth token (scope mcp:read) on a route that creates or cancels work (details.reason insufficient_scope), or a cross-origin form post. |
EMAIL_NOT_VERIFIED | 403 | |
ACCOUNT_SUSPENDED | 403 | |
RESOURCE_NOT_FOUND | 404 | No task, batch or grid with that id in your account, or no endpoint at that /v1 path. |
RESOURCE_ALREADY_EXISTS | 409 | The idempotency key was already used with a different request (details.reason idempotency_mismatch), or a batch key is older than 30 days (idempotency_key_expired). |
INVALID_STATE | 409 | The resource cannot do that now, for example cancelling a task that is no longer queued (details.reason task_not_queued, details.status). |
METHOD_NOT_ALLOWED | 405 | The path does not take this HTTP method. The Allow header lists the ones it takes. |
LOCATION_UNSUPPORTED | 422 | The engine does not take that location field (state, uule, city or location), or does not support grids (details.reason grid_unsupported). |
REGION_UNSUPPORTED | 422 | The engine is not served from that country right now (details.cause not_served, engine_not_offered or unknown_country). Not retryable; see /v1/countries?taskType=. |
EVIDENCE_UNSUPPORTED | 422 | |
ENGINE_DISABLED | 422 | The engine you named exists but is disabled on this server (details.taskType). Not retryable: pick an engine from GET /v1/capabilities. A queued task whose engine is disabled before it runs fails with this code and is refunded. |
ENGINE_UNAVAILABLE | 503 | The engine you named exists but is not available right now (details.taskType). Safe to retry later, or pick another engine from GET /v1/capabilities. A name that is no engine at all answers 400 VALIDATION_ERROR. |
SERVICE_UNAVAILABLE | 503 | A part of the server is temporarily unavailable (for example account signup while it is being configured). Retry later. |
QUEUE_LIMIT_EXCEEDED | 429 | Too many pending tasks on the account. Wait for some to finish (Retry-After gives a hint in seconds). |
RATE_LIMITED | 429 | Too many requests for this API key this minute (default 600). Wait Retry-After seconds. Every response carries RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset. |
PAYLOAD_TOO_LARGE | 413 | The request body is too large: about 1 MB, or 16 MB for POST /v1/batches. Split the work into more requests. |
UNSUPPORTED_MEDIA_TYPE | 415 | The body was sent as a type other than JSON (form data, XML...). Send JSON with Content-Type: application/json. |
INTERNAL_ERROR | 500 | Something failed on our side. Safe to retry. |
GOOGLE_REDIRECT_UNRESOLVED | 502 |
Which errors to retry
| Retry | Codes |
|---|---|
Yes, after Retry-After | RATE_LIMITED, QUEUE_LIMIT_EXCEEDED |
| Yes, later | ENGINE_UNAVAILABLE, INTERNAL_ERROR |
| No, fix the request | VALIDATION_ERROR, LOCATION_UNSUPPORTED, REGION_UNSUPPORTED, ENGINE_DISABLED, PAYLOAD_TOO_LARGE, UNSUPPORTED_MEDIA_TYPE |
| No, fix the credentials or the balance | MISSING_API_KEY, INVALID_API_KEY, FORBIDDEN, INSUFFICIENT_CREDITS |
Use an idempotency key so a retried submit never runs the same task twice.
Task errors
A failed task has an error object with one of these codes. Failed tasks are refunded.
TIMEOUT, NO_ANSWER, ENGINE_REFUSED, ENGINE_ERROR, LOCATION_UNSUPPORTED, UNSUPPORTED, TASK_CANCELLED, INSUFFICIENT_CREDITS, ENGINE_DISABLED
Last updated