Error Reference

Except for file downloads (which return the file itself on success), all error responses are JSON and include at least a message field. 422 responses also include an errors field, keyed by field name, listing the error messages for each field.

Status code Meaning Common causes
401 Authentication failed Missing X-Api-Key, the key doesn't exist or has been revoked, or the trial key's credit grant has expired (see Authentication)
402 Insufficient credits When creating a task, the paid balance or trial credit grant isn't enough (see Credits and Billing)
404 Not found, or doesn't belong to you The queried or downloaded task doesn't exist or doesn't belong to this key's account; the key in a download isn't in the task's result (see Query Tasks and Download Results)
410 Expired or deleted When downloading, the result file's retention period has ended or the file has been deleted (see Query Tasks and Download Results)
422 Invalid parameters Field validation failed; model doesn't exist (Unknown model alias: {model}); the model isn't currently available (Model {model} is not available); the format, base64, image type, or size of images is invalid
429 Too many requests The key's per-minute or per-day request limit was exceeded (Too Many Attempts.); too many queued tasks of the same type (Too many pending tasks of this type; please retry later.). Both include a Retry-After header; see below

Task failure error_code

Failures that occur after a task is created successfully (201) are not reported with an HTTP status code. Instead, the task's status becomes 30, with error_code and error_message set (see Query Tasks and Download Results). All failed tasks are fully refunded.

error_code Cause
face_age_minor A minor is in the image; see Pre-generation Age Check
face_age_uncertain Couldn't confirm that the people in the image are adults. You can resubmit with age_declared: true; see Pre-generation Age Check
face_check_failed The age check service is temporarily unavailable; please resubmit later
service_unavailable This model is currently short on resources and the task hasn't started processing; please resubmit later

Examples

Missing API key (401):

{ "message": "API key required." }

Insufficient credits (402):

{ "message": "Insufficient credits to complete this charge." }

Task doesn't exist or doesn't belong to you (404):

{ "message": "Task not found." }

Result file's retention period has ended (410):

{ "message": "File has expired." }

Field validation failed (422):

{
  "message": "The duration field is required.",
  "errors": { "duration": ["The duration field is required."] }
}

Too many queued tasks (429):

{ "message": "Too many pending tasks of this type; please retry later." }

Request limit used up (429):

{ "message": "Too Many Attempts." }

Handling 429

Both kinds of 429 include a Retry-After header (in seconds). Wait that long before retrying; don't resend immediately.

message Cause Headers included
Too Many Attempts. This key's per-minute or per-day request limit is used up. Querying task status counts toward it Retry-After, X-RateLimit-Reset, X-RateLimit-Limit, X-RateLimit-Remaining
Too many pending tasks of this type; please retry later. The account has reached the limit for queued tasks of the same type Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining

For the meaning of each header, see "Response headers" in Authentication; you can check your own limits with Check Usage Limits. If you used up your requests by polling for results, see No Public URL? Poll for Results.