OCR Router
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

CodeDescription
200OK. Request successful.
400Bad Request. Check your parameters.
401Unauthorized. Invalid API key.
402Payment Required. Insufficient credits.
404Not Found. Endpoint or resource does not exist.
429Too Many Requests. Rate limit exceeded.
500Internal Server Error. Something went wrong on our end.
502Bad Gateway. Upstream provider (e.g., Google, OpenAI) failed.

Error Types

TypeDescription
authentication_errorIssues with your API key or account permissions.
invalid_request_errorIssues with the request parameters (e.g. invalid URL, missing model).
insufficient_credits_errorAccount balance is too low for the request.
provider_errorThe underlying AI provider failed to process the document.
rate_limit_errorYou have exceeded your rate limit.
api_errorUnexpected internal errors.

Common Error Codes

CodeStatusDescription
insufficient_credits402Your balance is insufficient for the requested model/operation.
rate_limit_exceeded429Too many requests. Check Retry-After header.
validation_error400Request body validation failed (Zod error).

On this page