Skip to main content

Error codes

Every API error arrives in the same envelope:

{
"error": {
"code": "insufficient_funds",
"message": "not enough doubloons: need 150, balance is 100"
}
}

code is a machine string — branch on it in your code. message is for humans; its format is not guaranteed, don't parse it.

Code table

HTTPcodeMeaningWhat to do
400bad_requestMalformed request overallCheck body and headers
401unauthorizedKey missing, invalid, or revokedReissue the key: /apikey in the bot
402insufficient_fundsNot enough doubloons for the orderTop up in the bot; check GET /balance
403forbiddenAccess deniedMake sure your key touches your own resources
404not_foundNo such order, webhook, or fileCheck the id; order files live 30 days
409fair_use_exceededPlan fair-use limit exhausted (heavy videos)Wait for next month or pay in doubloons
409not_awaiting_reviewThe order is not waiting for script reviewReview only works in awaiting_review
422invalid_paramsBody failed validationmessage names the field and the reason
429rate_limitedOver 30 POST/minute on the keySlow down, respect Retry-After
429active_tasks_exceededAlready 10 active tasks (queued+running)Wait for done/error, respect Retry-After
500internal_errorSomething broke on our sideRetry with backoff; if it persists — support
502generator_unavailableGenerator temporarily unavailableRetry with backoff
503service_unavailableService under maintenanceRetry with backoff

Limits and Retry-After

Each key has two limits: 10 active tasks (queued + running) and 30 POST per minute. Exceeding either returns 429 with a Retry-After header (seconds until the next attempt). Respect it — it's cheaper than guessing.

Good manners

  • Idempotency-Key on every POST to /videos and /videos:quick — client retries must not double-charge. A repeat with the same key within 24 hours returns the original task (200 instead of 201).
  • Retry GETs with exponential backoff and jitter; on 429/5xx follow Retry-After.
  • A generation failure (status: "error" on the order) is not an HTTP error: doubloons for it are refunded to the balance automatically, same as in the bot.

Support: @piratepress_support.