Skip to Content
API referenceVideo GenerationError Codes

Error codes

Errors from every Video API endpoint use the same JSON structure:

{ "error": { "code": "...", "message": "..." } }

The HTTP status code indicates the category of the problem; error.code is a stable string identifier for branching in code. Always match on error.code; do not parse the error.message text.

Error code table

HTTPcodeMeaning
400invalid_requestA parameter is missing or has an invalid value
400unsupported_parameterThe model does not support the given duration, resolution, aspect_ratio, or generation mode. message lists the allowed values, e.g. duration 3 out of range [4, 15]
400invalid_callback_urlcallback_url is not HTTPS or points to a private network (blocked by SSRF validation)
400references_conflictframe_images and input_references were sent in the same request (mutually exclusive)
400too_many_referencesinput_references exceeds the limits (images > 9 / audio > 3 / video > 1)
400cancel_not_supportedThe upstream provider does not support interrupting this task
400cancel_failedThe task is already in a terminal state and cannot be cancelled
401unauthorized / invalid_api_keyAuthentication failed
401upstream_auth_failedUpstream provider authentication failed
402insufficient_creditsInsufficient balance to accept the task
404not_foundThe task does not exist, or you do not have access to it
404model_not_foundThe model does not exist
429rate_limitedRate limit exceeded (polling rate limit or upstream rate limit)
502upstream_error / route_errorUpstream provider error / routing failure
504upstream_timeoutThe upstream provider did not accept the task in time
500internal_errorInternal error

references_conflict and too_many_references are request-body validation errors; see Create video task for the exact limits. For how cancel_not_supported and cancel_failed are determined, see Cancel task. not_found is returned both when the task does not exist and when it belongs to a different API key; the two cases are deliberately not distinguished.

Errors during task submission

POST /v1/videos waits up to 45 seconds for the upstream provider to accept the task:

  • If the upstream responds within 45 seconds, the result is returned directly: 202 on success, or one of the errors above on failure.
  • If the upstream has not responded after 45 seconds, the request returns 202 with status: "pending" and the task id, and submission continues in the background. If it fails later, the task becomes failed and the reason is in the task’s error field (and in the webhook, if callback_url is set).
  • If the upstream ultimately does not accept the task, it fails with upstream_timeout. Anything pre-authorized for a failed task is fully refunded.

This means codes such as invalid_request, input_moderation_failed, rate_limited, upstream_error, and upstream_timeout can appear either in the create response or in the task’s error. Handle both.

real_person preprocessing errors

Before preprocessing starts, the following requests return 400 invalid_request immediately, and no task is created:

  • frame_images is also sent: real_person only supports input_references;
  • input_references contains no image.

When preprocessing for real_person: true fails because of a problem with the supplied image, the API returns HTTP 400 with error.code set to invalid_request. The end of error.message contains one of the following stable reason codes and identifies the failing reference, for example input_references[0]:

Reason codeHow to fix
bad_data_uriThe data: URI is malformed, or its base64 content is invalid
download_failedThe image could not be downloaded because of a connection, timeout, or access-control problem
unreachableThe image URL returned a non-success HTTP status
not_imageThe downloaded content is not a supported, decodable image
too_largeThe image exceeds the file size, pixel count, or per-request processing limit
{ "error": { "code": "invalid_request", "message": "real_person image processing failed — input_references[0]: ... (not_image)" } }

Application logic should still branch on error.code; use the reason code and reference location to correct the input or troubleshoot.

402 Insufficient credits

insufficient_credits is returned only when creating a task (POST /v1/videos). With pre-authorization enabled, ofox estimates the cost from the requested resolution and duration before accepting the task; if the estimate exceeds your account balance, the request is rejected immediately. The task is not stored and nothing is charged.

{ "error": { "code": "insufficient_credits", "message": "..." } }

insufficient_credits is the only code the Video API returns with 402. Integrations only need to handle this one code: top up and retry.

429 Rate limiting

rate_limited covers both the per-key polling rate limit on GET /v1/videos/{id} and upstream rate limits. When the polling rate limit is triggered, the response includes a Retry-After header:

HTTP/1.1 429 Too Many Requests Retry-After: 1 Content-Type: application/json { "error": { "code": "rate_limited", "message": "..." } }

Respect the Retry-After header and back off before retrying. If you poll too often, switch to Webhooks: ofox pushes the terminal state to you, avoiding the polling rate limit entirely. Creating tasks (POST) and cancelling tasks (DELETE) are not affected by the polling rate limit.

Last updated on