Skip to content

Error codes

Updated

Envelope#

{
  "success": false,
  "error": {
    "code": "invalid_file_type",
    "message": "Unsupported file type. Accepted types: PDF, JPG, PNG",
    "details": { "uploaded_type": "image/gif" }
  }
}

Branch on error.code, never on error.message. Codes are stable; wording is not. details is present on some errors only.

Authentication and quota#

CodeHTTPMeaning
invalid_api_key401Missing, malformed, revoked, or inactive key
expired_api_key401Key past its expiry date
usage_limit_exceeded402Key's request cap is reached
insufficient_credits402Remaining credits do not cover this document's pages
rate_limit_exceeded429Default limits: 10/min, 100/hour, 1000/day, 10000/month
too_many_open_jobs429Maximum 5 unexpired multi-page jobs per key

Rate-limited responses carry X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset (Unix timestamp). Read them instead of guessing a backoff.

Request problems#

CodeHTTPMeaning
invalid_request400Missing a required parameter, e.g. job_id
invalid_file400No file uploaded, or the upload failed
invalid_file_type400Not PDF, JPG, or PNG. details.accepted_types lists what is allowed
file_too_large413Over 10 MB
invalid_options400options is not valid JSON, or the form field is misnamed
unknown_model400No active prompt template by that name
page_limit_exceeded400Over 150 pages
method_not_allowed405Wrong HTTP verb

Processing#

CodeHTTPMeaning
extraction_failed422File accepted, extraction did not succeed
persist_failed500Extraction succeeded but storage failed — no credits charged, safe to retry
server_error500Unhandled error
server_busy503Staging capacity exhausted; retry in a few minutes
Warning
extraction_failed on the synchronous path still deducts 1 credit. Budget for this when reconciling usage. On the multi-page path the chunk stays available and is not charged until it succeeds.

Multi-page specific#

CodeHTTPMeaning
job_not_found404No such job for this key. Jobs are key-scoped, so another key's job is indistinguishable from a missing one
job_expired410Past the 2-hour TTL, or already finalized. Re-upload
chunk_in_progress409Another request holds the claim. Retry shortly; a stuck claim frees after 120 seconds
chunk_source_lost410Staged source file is gone. Re-upload

Retry guidance#

SituationAction
rate_limit_exceededBack off until X-RateLimit-Reset
chunk_in_progressRetry the same chunk after a short delay
extraction_failed on a chunkRetry that chunk job_id — replay is idempotent and not double-charged
persist_failedRetry; nothing was charged
server_busyRetry after a few minutes
job_expired, chunk_source_lostDo not retry — re-upload the document
insufficient_credits, usage_limit_exceededDo not retry — top up first