Skip to content

Reference

Errors

One error shape, a stable code, and whether anything was charged.

Every error answers with an HTTP status and the same body. Branch on code, show message, and send us request_id (also in the X-Request-Id header) when you need help.

{
  "error": {
    "code": "insufficient_balance",
    "message": "Your balance does not cover this request. Nothing was charged.",
    "request_id": "req_7Xc2LmQ9vT4nRk8Ws1Bd"
  }
}

Codes

StatusCodeMeaning
400invalid_requestA field is missing, of the wrong type or off the model's grid. The message names the field.
400model_not_foundUnknown model id, or a model sent to another endpoint than its own: a video model to the image endpoint (and the reverse), a clip editor to a generation endpoint (and the reverse).
400content_policyRefused by the content policy. Nothing was charged.
400invalid_inputAn input picture could not be used. Nothing was charged.
400invalid_videoThe clip of a clip edit could not be used: its address, format, length, size or frame rate. The message says which. Nothing was charged.
400max_cost_exceededThe request costs more than its max_cost_usd. Nothing was charged. See Quotes.
400private_unavailableprivate: true on a model without options.private, or on a clip edit. Nothing was charged. See Private mode.
400file_expiredAn upload or a file named in the request is no longer available. Nothing was charged.
401unauthorizedMissing, invalid or revoked key.
402insufficient_balanceThe balance does not cover the hold. Nothing was charged.
403forbiddenNot allowed from here, e.g. a file link whose signature is invalid or expired.
404not_foundNo such generation or file for this key.
405method_not_allowedWrong method on a real path.
409idempotency_conflictThis Idempotency-Key was used with another request. Use a new key. See Idempotency.
409request_in_progressThe first request with this Idempotency-Key has not answered yet. Wait for Retry-After.
409not_readyThe generation has no file to download yet, or this output failed.
409conflictNot in this state: e.g. the workspace already holds 100 uploads.
410file_expiredThe file is no longer stored.
413invalid_requestBody over 16 MB (send pictures by URL, or upload them), or an upload over the size for its kind.
429rate_limitedPast the workspace's requests or uploads a minute. Wait for Retry-After. See Rate limits.
429concurrency_limitToo many generations running for the workspace. Retry when one finishes.
500internal_errorSomething broke on our side. Retry, or send us the request_id.
503model_unavailableThe model is down for now. Nothing was charged.
503service_unavailableThe service is down for now. Nothing was charged.

A generation that fails

Once a request is accepted (202), a failure shows on the generation, not as an HTTP error: status: "failed" with error.code generation_failed or timeout. The hold is released and cost_usd is 0.

Retrying

  • 429 and 503: retry after the Retry-After header, or with a growing delay.
  • 400, 401, 402, 404: fix the request, the key or the balance first; the same call fails the same way.
  • Retrying a request that starts work after a timeout? Send it with an Idempotency-Key: a second try returns the first generation instead of running again.
  • A failed generation: submit it again. Nothing was charged for the first try.