Error Response Format
Most each::labs REST errors use this JSON shape. Prediction results, safety refusals and the OpenAI-compatible endpoints use the variants documented below.Prediction-Envelope Errors
Prediction-based products (including the Video API) report failures asynchronously. The submit call succeeds with a prediction ID, and the failure arrives when you poll: the prediction returnsstatus: "error" and its output carries an error envelope with error_code and error_message fields — not the HTTP {"error": ...} shape above. For the full envelope and the catalog of error codes, see the Video API error catalog.
HTTP Status Codes
Common Errors
400: Bad Request
- Missing required parameters
- Invalid parameter types or values
- Malformed JSON body
- Input validation failure
401: Unauthorized
Authorization: Bearer YOUR_API_KEYheader not included- API key is invalid or expired
402: Payment Required
- The requested model costs more than your current balance
- The combined estimated cost of your in-flight predictions would exceed your balance — each running prediction reserves its estimated cost until it settles
- Top up your balance, or wait for an in-flight prediction to finish. A settled prediction releases the difference between its estimate and its real cost.
403: Forbidden
- Attempting to modify a locked workflow or version
- Insufficient permissions for the requested operation
404: Not Found
- Invalid model slug
- Non-existent prediction ID, workflow ID, or execution ID
- Resource was deleted
429: Too Many Requests
details for the cap that was hit — it always names the number that applied.
Handling:
- Keep your balance above $10.00 — the cap does not apply above that threshold
- Otherwise, wait for an in-flight prediction to reach a terminal status and resubmit; the slot frees when it settles
- Retry with exponential backoff when
detailsreports that too many executions were started at once — that variant is transient
500: Internal Server Error
- Retry with exponential backoff
- If persistent, contact support
Safety Refusals
each::labs safety controls can refuse a request before any model runs. A block or a content-safety refusal comes back every time you resend the same request, so do not resend it unchanged. The two503 outage codes are the exception: retry them with backoff. For END_USER_ID_REQUIRED, fix your code so it sends safety_identifier, then send the request again. Branch on the code, not the message: the message is usually the fixed text below. END_USER_BLOCKED and ORGANIZATION_BLOCKED never identify the end user, the organization or the reason. SAFETY_PREFLIGHT_BLOCKED can return approved guidance text and a help link instead of its usual message.
When we suspend an organization, every request from it that would run a model or a workflow is refused with 403 ORGANIZATION_BLOCKED.
The codes below are part of the API contract now. The checks behind them are switched on without notice, so handle them today.
safety_identifier is required. A request without it can be refused at any time with 400 END_USER_ID_REQUIRED: enforcement is switched on per organization, without notice. A workflow trigger is still accepted, and the step fails instead. See Safety identifier requirements.
On POST /v1/prediction, the codes appear in details:
execution_id when the platform recorded the refused execution. An END_USER_BLOCKED or ORGANIZATION_BLOCKED refusal against an unknown or deprecated model has no execution_id.
A refusal is returned by the request that creates the model execution. A workflow trigger creates a workflow execution and returns its normal 202 response with the workflow execution_id; each step creates its own model execution when it starts its model. A refused step fails, and the workflow execution does not carry the refusal code; Workflows shows what it carries instead.
The OpenAI-compatible endpoints and POST /v1/decisions use their own error envelope, with the same code and message:
type is invalid_request_error for 400, 403, and 422, and server_error for 503.
Handling:
END_USER_ID_REQUIRED: add a validsafety_identifierand resendEND_USER_BLOCKED,ORGANIZATION_BLOCKED,SAFETY_PREFLIGHT_BLOCKED: do not retrySAFETY_BLOCKS_UNAVAILABLE,SAFETY_PREFLIGHT_UNAVAILABLE: retry with exponential backoff; the request was not executed
Product-Specific Errors
each::api: Prediction Errors
each::workflows: Execution Errors
each::sense: Agent Errors
Retry Strategy
We recommend exponential backoff for500 and 503, with a cap on attempts. A 429 clears only when a prediction settles or your balance rises, so bound those retries too. Here’s how to set that up:
Backoff alone does not clear a 429 concurrency cap: the slot frees when an in-flight prediction settles, so retry a bounded number of times and surface the
details text rather than looping.Safety refusals are different: resending the same request after a 400, 403 or 422 safety code gets the same refusal. For END_USER_ID_REQUIRED, fix your code so it sends safety_identifier. Retry only the 503 safety outages (SAFETY_BLOCKS_UNAVAILABLE, SAFETY_PREFLIGHT_UNAVAILABLE).