Skip to content

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.

View as Markdown

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"
  }
}
  • code is stable: branch on it, not on message.
  • details.reason refines some codes.
  • Every response carries X-Request-Id. Send your own to correlate. Quote it when you report a problem.
  • Unknown /v1 paths answer 404 and wrong methods 405, in the same envelope.

Request errors

CodeHTTPMeaning
VALIDATION_ERROR400The body or a parameter is invalid. details lists each field.
MISSING_API_KEY401No API key. Send it as X-API-Key or as Authorization: Bearer.
INVALID_API_KEY401The key is unknown or revoked.
INSUFFICIENT_CREDITS402Not enough available credits, or the key reached its daily limit (details.reason daily_key_limit).
PLAN_REQUIRED402
FORBIDDEN403The 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_VERIFIED403
ACCOUNT_SUSPENDED403
RESOURCE_NOT_FOUND404No task, batch or grid with that id in your account, or no endpoint at that /v1 path.
RESOURCE_ALREADY_EXISTS409The 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_STATE409The resource cannot do that now, for example cancelling a task that is no longer queued (details.reason task_not_queued, details.status).
METHOD_NOT_ALLOWED405The path does not take this HTTP method. The Allow header lists the ones it takes.
LOCATION_UNSUPPORTED422The engine does not take that location field (state, uule, city or location), or does not support grids (details.reason grid_unsupported).
REGION_UNSUPPORTED422The 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_UNSUPPORTED422
ENGINE_DISABLED422The 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_UNAVAILABLE503The 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_UNAVAILABLE503A part of the server is temporarily unavailable (for example account signup while it is being configured). Retry later.
QUEUE_LIMIT_EXCEEDED429Too many pending tasks on the account. Wait for some to finish (Retry-After gives a hint in seconds).
RATE_LIMITED429Too 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_LARGE413The request body is too large: about 1 MB, or 16 MB for POST /v1/batches. Split the work into more requests.
UNSUPPORTED_MEDIA_TYPE415The body was sent as a type other than JSON (form data, XML...). Send JSON with Content-Type: application/json.
INTERNAL_ERROR500Something failed on our side. Safe to retry.
GOOGLE_REDIRECT_UNRESOLVED502

Which errors to retry

RetryCodes
Yes, after Retry-AfterRATE_LIMITED, QUEUE_LIMIT_EXCEEDED
Yes, laterENGINE_UNAVAILABLE, INTERNAL_ERROR
No, fix the requestVALIDATION_ERROR, LOCATION_UNSUPPORTED, REGION_UNSUPPORTED, ENGINE_DISABLED, PAYLOAD_TOO_LARGE, UNSUPPORTED_MEDIA_TYPE
No, fix the credentials or the balanceMISSING_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