Skip to content

Troubleshoot API errors

  1. Check the HTTP method and request path against the documentation for the endpoint.
  2. Record the HTTP status and machine-readable error fields. Chat Completions returns error.type, error.code, and error.param. Creative Lab and the Business API often return a numeric code at the top level. MCP may include the code in the tool message.
  3. Open the error reference for the service. If the response includes error.param or details[].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.

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

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

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

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

Wait for the interval specified in the error message before retrying. Keep subsequent calls within the rate limit. MCP rate limit details

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.