Errors
All errors return JSON with statusCode and message.
{ "statusCode": 422, "message": "Your prompt contains content we can't generate. Please rephrase and try again.", "error": "Unprocessable Entity"}HTTP error codes
Section titled “HTTP error codes”| Status | Meaning | Action |
|---|---|---|
400 | Bad request — invalid input | Fix the request body |
401 | Unauthorized — missing or invalid key | Check your API key |
403 | Forbidden — insufficient permissions | Upgrade plan or check role |
404 | Not found | Check the resource ID |
422 | Prompt safety rejection | Rephrase your prompt |
429 | Rate limit exceeded | Wait Retry-After seconds |
500 | Internal server error | Retry; contact support if persistent |
Task-level errors
Section titled “Task-level errors”Tasks can fail asynchronously. When status === "FAILED", the task document includes an error field:
{ "id": "task_abc123", "status": "FAILED", "error": { "code": "MODEL_ERROR", "message": "The model returned no output. Try a different prompt.", "retryable": true }}retryable: true means you can resubmit the same prompt without modification.