Skip to content
Guides/Handling errors
Guides

Handling errors

Understand API errors and decide when to fix, retry, or contact support.

Error format

Analyze errors use application/problem+json, with an HTTP status and a machine-readable code:

JSON
{
  "status": 402,
  "title": "Payment Required",
  "code": "insufficient_credits",
  "detail": "This account has insufficient available credits."
}

Branch on status and code in your integration. Treat detail as a human-readable explanation. Record the X-Request-ID response header to help diagnose a specific request attempt.

Status codes

StatusCodeWhat to do
400 or 422invalid_requestCheck the schema, number of images, USD currency, hint length, and idempotency key.
401unauthorizedCheck that the bearer credential is present, valid, and active.
402insufficient_creditsAdd available credits in Billing.
403account_ineligibleCheck your account’s status and contact support if needed.
409idempotency_conflictThe key belongs to another payload. Recover with the original payload or use a new key for intentional new work.
409request_in_progressWait for Retry-After, then retry with the same key and payload.
409previous_request_failedThe previous operation ended without a charge. Use a new key for a new analysis.
413request_too_largeReduce the JSON body to 32 KiB or less. Send image URLs, not image bytes.
415unsupported_media_typeSet Content-Type: application/json.
422invalid_imageCheck public accessibility, format, file size, and image dimensions.
429rate_limitedWait for Retry-After, then retry with the same key and payload using bounded backoff.
502analysis_failedNo complete analysis was produced and no analysis credit was consumed. Start a new analysis with a new key when ready.
503analysis_unavailableRetry with the same key and payload using bounded backoff.
503rate_limit_unavailableWait for Retry-After, then retry with the same key and payload using bounded backoff.

Retry carefully

For transport errors, an unexpected server error, or an unreadable response, the result may be uncertain. Preserve your key and payload and follow Idempotency & retries.

Do not continuously retry validation or authentication errors. Fix the cause first. A returned Retry-After header gives the minimum delay in seconds before retrying. See Traffic limits for account sustained and burst limits.

Get help

Contact support with the request ID, approximate time, HTTP status, and error code. Include a description of what you expected. Keep API keys and private image URLs out of support messages.