Skip to Content

Errors

When a request fails, the API returns the standard envelope with status: "error", a null data, and an error object carrying a stable code and a human-readable message:

{ "status": "error", "data": null, "error": { "code": "INSUFFICIENT_CREDITS", "message": "Workspace does not have enough credits." } }

Branch your code on the HTTP status and error.code. The message is for humans and may change; the code is part of the contract.

Error codes

HTTPerror.codeWhen
400VALIDATION_ERRORRequest failed schema validation.
400INVALID_INPUTA field value is not acceptable.
400MISSING_REQUIRED_FIELDA required field or query param is absent.
401UNAUTHORIZEDNo credential supplied.
401INVALID_API_KEYAPI key is malformed or unknown.
401API_KEY_EXPIREDAPI key passed its expiration date.
401INVALID_TOKENBearer token is invalid (browser path).
401TOKEN_EXPIREDBearer token expired (browser path).
402PAYMENT_REQUIREDPayment is required to proceed.
402INSUFFICIENT_CREDITSNot enough credits for this generation.
403FORBIDDENAuthenticated but not allowed.
403INSUFFICIENT_PERMISSIONSPlan lacks the required feature (e.g. useApiKeys, batchGenerate).
404NOT_FOUNDResource does not exist.
404DESIGN_NOT_FOUNDNo such design in the workspace.
404PDF_NOT_FOUNDNo such generated PDF / job output.
409ALREADY_EXISTSResource conflict.
409DUPLICATE_ENTRYA unique constraint was violated.
500INTERNAL_ERRORUnexpected server error.
500DATABASE_ERRORStorage layer failed.
500S3_ERRORObject storage failed.

Handling errors well

  • Retry 5xx responses with backoff; they are usually transient.
  • Do not retry 400/401/403/404 without changing the request — they are deterministic.
  • On 402 INSUFFICIENT_CREDITS, surface a top-up prompt rather than retrying.
  • On 401 API_KEY_EXPIRED or INVALID_API_KEY, rotate the key — see Authentication.