Troubleshoot API errors
Where to begin
Section titled “Where to begin”- Check the HTTP method and request path against the documentation for the endpoint.
- Record the HTTP status and machine-readable error fields. Chat Completions returns
error.type,error.code, anderror.param. Creative Lab and the Business API often return a numericcodeat the top level. MCP may include the code in the tool message. - Open the error reference for the service. If the response includes
error.paramordetails[].key, find the field with that name in your request.
For streaming responses, inspect the events after the connection opens. A stream can start with HTTP 200 and later contain an error. The SSE guide shows how to handle the final event and a dropped connection.
Services handbooks
Section titled “Services handbooks”- Chat Completions covers API keys, balance, request fields, and model availability.
- Anthropic Messages describes errors in the Anthropic format.
- Creative Lab covers input data, limits, and media task results. For
status: failed, checkerrorin the task response. - Business API covers key permissions, roles, balances, and transfers.
- MCP covers connections, tools, and limits.
- Transcription covers file uploads and response formats.
Examples of errors and decisions
Section titled “Examples of errors and decisions”Chat Completions · invalid_model_error · 404
Section titled “Chat Completions · invalid_model_error · 404”Use the same API key to look up the exact ID in the model catalog, then update the
model field.
Example error response
Chat Completions · model is required · 400
Section titled “Chat Completions · model is required · 400”Add model to the top level of the JSON request body alongside messages. Example error response
Creative Lab · ERR_EMPTY_PROMPT · 400
Section titled “Creative Lab · ERR_EMPTY_PROMPT · 400”A price estimate for kling-v3 with a missing prompt returns code: 3 and
details[].key: "prompt". Include prompt
at the top level of the request body alongside model.
Error details
Embeddings · invalid_input · 422
Section titled “Embeddings · invalid_input · 422”If error.param is input, send
text in the input field. When input is empty or missing, the error message is
input must be not empty.
Authorisation · unauthorized_request_error · 401
Section titled “Authorisation · unauthorized_request_error · 401”Check that the Authorization header contains an active API key.
Get or replace an API key
Business API · code 36 · 403
Section titled “Business API · code 36 · 403”If POST /api/v1/orgs/list returns code 36, your organization does not have permission to view the list of client organizations.
Cause and next steps
MCP · RATE_LIMITED
Section titled “MCP · RATE_LIMITED”Wait for the interval specified in the error message before retrying. Keep subsequent calls within the rate limit. MCP rate limit details
If you need support
Section titled “If you need support”Include the time of the request and its time zone, the HTTP method and path, the HTTP status, and the error message. If the API returned a trace_id, include it as well. Remove your API key and any sensitive data from the request details before sharing them with support.