Core concepts

Errors

Errors use conventional HTTP status codes and one JSON shape with a stable code you can branch on.

Error shape

402 Payment Required
{
  "error": {
    "code": "INSUFFICIENT_CREDITS",
    "message": "This request costs 46 credits; 12 are available.",
    "request_id": "req_6c250b68f1a042ca8ea4fd4c469dc3b4",
    "details": {
      "required": 46,
      "available": 12
    }
  }
}
  • code — stable; branch on it.
  • message — human-readable; may change; don’t parse it.
  • request_id — also in the X-Request-Id header on every response. Include it when contacting support.
  • details — optional structured context (e.g. validation issues as [{ path, message }], limits, allowed values).

Error codes

HTTPCodeMeaningWhat to do
400VALIDATION_ERRORInvalid body, parameter or option for the model.Fix the request; see details.
400IDEMPOTENCY_KEY_REQUIREDWrite request without an Idempotency-Key.Add the header.
401UNAUTHORIZEDMissing, malformed, unknown or revoked key.Check the key.
402INSUFFICIENT_CREDITSBalance below the price.Top up; details.required/available.
402SPEND_CAP_REACHEDThe key’s monthly credit limit would be exceeded.Raise the limit or wait for next month.
403PLAN_REQUIREDPaying account is not on Influencer or Agency.Upgrade the plan.
403SCOPE_REQUIREDThe key lacks the scope for this endpoint.Use a key with that scope.
403ACCOUNT_SUSPENDEDThe account is suspended.Contact support.
403LIMIT_REACHEDA plan quantity limit (keys, webhooks, characters, products).Delete something or upgrade.
404NOT_FOUNDUnknown ID, another account’s resource, or unknown endpoint.Check the ID/path.
409CONFLICTWrong state, e.g. cancelling a processing generation.Re-read the resource.
409IDEMPOTENCY_CONFLICTKey reused with a different request.Use a new key.
409IDEMPOTENCY_IN_PROGRESSThe first request with this key is still running.Retry in a few seconds.
409SOCIAL_ACCOUNT_REQUIREDThe platform is not connected for the character.Create a connect link.
422CONTENT_BLOCKEDThe content is not allowed. Nothing is charged.Change the prompt or media.
429RATE_LIMITEDToo many requests for the key.Wait Retry-After seconds.
429CONCURRENCY_LIMITToo many jobs running for the account.Wait for one to finish.
502PROVIDER_ERRORAn upstream model failed.Retry later with the same key.
504TIMEOUTAn upstream step timed out.Retry with the same key.
500INTERNAL_ERRORUnexpected error on our side.Retry with the same key; contact support with the request_id if it persists.

Generation failures

A request can be accepted (202) and the generation fail later. Then the generation has status: "failed", an error.code (CONTENT_BLOCKED, PROVIDER_ERROR, TIMEOUT, RATE_LIMIT, VALIDATION_ERROR, INSUFFICIENT_CREDITS or UNKNOWN) and the credits back in refunded_credits. The timeline shows which stage failed.

Getting help

Email support@oriorai.com with the subject “API”, the request_id and, for generations, the gen_ ID.