Documentation menu

Errors

The API uses conventional HTTP status codes, and every error carries the same JSON body: a stable machine-readable code for your program and a message for your logs.

The error body

Error response

{
  "error": {
    "code": "insufficient_credits",
    "message": "This job needs 3 credits and you have 1."
  }
}

Branch on error.code, not on the message. Messages are for humans and may be reworded; codes are part of the versioned contract and will not change meaning.

Status codes

StatusMeaning
200Request succeeded (also an idempotent replay of a previous submission).
202Job accepted and queued.
302Redirect to a signed download URL.
400invalid_request: a parameter is missing or malformed. Fix the request; retrying unchanged will fail again.
401unauthorized: missing, malformed or revoked API key.
402insufficient_credits: top up, then retry.
403forbidden: the key is valid but not allowed to do this.
404not_found: no such job on this account. Ids are account-scoped.
409conflict: the job already finished, or has no result yet.
413payload_too_large: the image exceeds 10 MB.
415unsupported_media_type: not a JPEG, PNG, WebP or AVIF.
429rate_limited: wait Retry-After seconds, then retry.
500server_error: our fault. Safe to retry with the same Idempotency-Key.

Handling failures

ParameterTypeDescription
4xx (except 429)don't retryThe request itself is wrong. Retrying unchanged gives the same answer. Fix and resend.
429retry after backoffWait the Retry-After seconds. Never busy-loop on it.
5xxretry with idempotencyTransient. Retry with the same Idempotency-Key so a request that actually landed isn't charged twice.
job.failedno chargeProcessing failures refund the job's credits automatically; the job's error field says what went wrong.