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
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:
202on success, or one of the errors above on failure. - If the upstream has not responded after 45 seconds, the request returns
202withstatus: "pending"and the taskid, and submission continues in the background. If it fails later, the task becomesfailedand the reason is in the task’serrorfield (and in the webhook, ifcallback_urlis 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_imagesis also sent:real_persononly supportsinput_references;input_referencescontains 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]:
{
"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.