Api
Errors
Understanding API error codes
Errors
The DocsRouter API uses standard HTTP status codes to indicate the success or failure of your API requests.
In the event of an error, the response body will contain an error object with details.
Error Object
{
"error": {
"type": "invalid_request_error",
"code": "validation_error",
"message": "The 'url' parameter must be a valid URL.",
"param": "url",
"request_id": "req_123..."
}
}HTTP Status Codes
| Code | Description |
|---|---|
200 | OK. Request successful. |
400 | Bad Request. Check your parameters. |
401 | Unauthorized. Invalid API key. |
402 | Payment Required. Insufficient credits. |
404 | Not Found. Endpoint or resource does not exist. |
429 | Too Many Requests. Rate limit exceeded. |
500 | Internal Server Error. Something went wrong on our end. |
502 | Bad Gateway. Upstream provider (e.g., Google, OpenAI) failed. |
Error Types
| Type | Description |
|---|---|
authentication_error | Issues with your API key or account permissions. |
invalid_request_error | Issues with the request parameters (e.g. invalid URL, missing model). |
insufficient_credits_error | Account balance is too low for the request. |
provider_error | The underlying AI provider failed to process the document. |
rate_limit_error | You have exceeded your rate limit. |
api_error | Unexpected internal errors. |
Common Error Codes
| Code | Status | Description |
|---|---|---|
insufficient_credits | 402 | Your balance is insufficient for the requested model/operation. |
rate_limit_exceeded | 429 | Too many requests. Check Retry-After header. |
validation_error | 400 | Request body validation failed (Zod error). |