Get started
Errors
Every error has the same shape:
{"error": {"code": "invalid_request", "message": "duration_min: required unless `script` is given (whole minutes)."}}codeis stable; branch on it.messageis for humans and names the field that failed.- Some errors add fields:
credits(new price),balance,queued,detail(extra context for our support team). - Every response carries an
x-request-idheader. Quote it when you contact support.
Codes
| Status | Code | Meaning |
|---|---|---|
| 400 | invalid_request | A field is missing, unknown or out of range. message names the field and the allowed values. |
| 400 | invalid_json | The body is not valid JSON. |
| 400 | image_required | Video models need a start frame: send image: {mime_type, base64}. |
| 401 | unauthorized | Missing, wrong or revoked key. |
| 402 | insufficient_credits | Not enough credits. Nothing was reserved; balance shows what you have. |
| 403 | access_required | This account cannot order yet. Sign in to the app once to finish setting up the account. |
| 404 | not_found | No such video or generation on this account. |
| 409 | price_changed | The price moved since your estimate. Send the new credits value returned in the error. |
| 409 | not_ready | The video or file is not finished yet. Keep polling. |
| 409 | conflict | The action does not fit the job's current state (for example a decision for a stop it is not waiting at). |
| 413 | payload_too_large | Body over 300 KB. Shrink the start frame. |
| 429 | rate_limited | Too many requests. 120 requests per minute per key; ordering has its own lower limit. |
| 500 | internal_error | Something broke on our side. Retry; if it keeps failing, contact support with the x-request-id. |
| 503 | service_unavailable | Production is paused or unreachable. Nothing was charged; retry in a few minutes. |
| 503 | model_unavailable | That model is temporarily down. Nothing was charged; try again later or pick another model. |
Common 400s on estimate
Most invalid_request errors are a field that the endpoint does not accept:
- Sending
creditsorstopsto/videos/estimate: leave them out; they are for the order only. - Leaving out
duration_minwithout ascript. - A
seconds,aspect_ratioorresolutionthe model does not support: check the model page. counton video or music models (useseconds), orsecondson image models (usecount).
Unknown fields are always rejected, so a typo never gets silently ignored.