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
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | A field is missing, of the wrong type or off the model's grid. The message names the field. |
| 400 | model_not_found | Unknown 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). |
| 400 | content_policy | Refused by the content policy. Nothing was charged. |
| 400 | invalid_input | An input picture could not be used. Nothing was charged. |
| 400 | invalid_video | The clip of a clip edit could not be used: its address, format, length, size or frame rate. The message says which. Nothing was charged. |
| 400 | max_cost_exceeded | The request costs more than its max_cost_usd. Nothing was charged. See Quotes. |
| 400 | private_unavailable | private: true on a model without options.private, or on a clip edit. Nothing was charged. See Private mode. |
| 400 | file_expired | An upload or a file named in the request is no longer available. Nothing was charged. |
| 401 | unauthorized | Missing, invalid or revoked key. |
| 402 | insufficient_balance | The balance does not cover the hold. Nothing was charged. |
| 403 | forbidden | Not allowed from here, e.g. a file link whose signature is invalid or expired. |
| 404 | not_found | No such generation or file for this key. |
| 405 | method_not_allowed | Wrong method on a real path. |
| 409 | idempotency_conflict | This Idempotency-Key was used with another request. Use a new key. See Idempotency. |
| 409 | request_in_progress | The first request with this Idempotency-Key has not answered yet. Wait for Retry-After. |
| 409 | not_ready | The generation has no file to download yet, or this output failed. |
| 409 | conflict | Not in this state: e.g. the workspace already holds 100 uploads. |
| 410 | file_expired | The file is no longer stored. |
| 413 | invalid_request | Body over 16 MB (send pictures by URL, or upload them), or an upload over the size for its kind. |
| 429 | rate_limited | Past the workspace's requests or uploads a minute. Wait for Retry-After. See Rate limits. |
| 429 | concurrency_limit | Too many generations running for the workspace. Retry when one finishes. |
| 500 | internal_error | Something broke on our side. Retry, or send us the request_id. |
| 503 | model_unavailable | The model is down for now. Nothing was charged. |
| 503 | service_unavailable | The 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
429and503: retry after theRetry-Afterheader, 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.