Skip to content

API Endpoints

Complete reference for the OpenOCR REST API.

Base URL

https://api.open-ocr.com/v1

Rate Limiting

POST /v1/ocr, POST /v1/ocr/batch, GET /v1/usage and engine warm-up share one limit: 300 requests per sliding 60 seconds per API key, the same for every account. There is no daily limit. A key can also carry a monthly request limit you set in the dashboard (429 api_key_limit_reached), and each engine has its own limit (429 engine_rate_limited).

bash
# Rate limit headers on POST /v1/ocr and GET /v1/usage responses:
# X-RateLimit-Limit: 300         # max requests per 60s window
# X-RateLimit-Remaining: 242     # requests left in current window
# X-RateLimit-Reset: 60          # always 60 on an allowed request; on a 429, seconds until a slot frees

# When rate limited (429):
# Retry-After: 30                # seconds to wait

See the Error Codes page for retry strategies.

Endpoints

MethodPathDescription
POST/v1/ocrProcess a document with OCR (sync or async)
POST/v1/ocr/batchProcess up to 20 images concurrently
GET/v1/ocr/:request_idRecover a saved result or check an in-flight request
GET/v1/ocr/jobs/:job_id/statusProgress of a large PDF job (image-only engine, over 20 pages)
GET/v1/ocr/jobs/:job_id/resultText of a finished large PDF job
GET/v1/enginesList available OCR engines with status (no auth required)
GET/v1/modelsThe same catalog grouped by model, with every route that serves it (no auth required)
POST/v1/engines/:engine_id/warmWake a self-hosted engine before a batch (see Scheduling batches)
GET/v1/usageYour recent OCR requests and what each was charged (paginated)
GET/api/usagePer-user usage history with pagination and date filters (dashboard endpoint)
GET/v1/healthHealth check (no auth required)
GET/v1/statusService status (minimal without auth, full with auth)
GET/v1/engines/healthLive health check of all local engines
GET/v1/engines/statsAggregated performance stats for all engines
GET/v1/engines/:engine_id/statsPerformance stats for a specific engine
GET/v1/engines/:engine_id/latencyHourly latency time-series (p50/p95/p99)
GET/v1/engines/:engine_id/uptimeDaily uptime history with check counts
GET/v1/changelogAPI changelog — version history and breaking changes

OCR Processing (Sync)

The primary endpoint for extracting text from documents. Returns the result synchronously.

Request Body

ParameterTypeRequiredDescription
Idempotency-Key (header)stringYesSend a new unique value (for example a UUID) for each logical request, and reuse the SAME value when you retry that request so it is processed and billed once. Use a NEW value for a different payload: Reusing a key with a DIFFERENT request body returns 409 idempotency_key_reused; the same key with the same request (even with different base64 line breaks or omitted default fields) replays the original result. The comparison is on the effective request (decoded base64 bytes, resolved engine, defaults applied such as output_format json, mode sync and language en; an omitted page_count compares equal to page_count 1), not its spelling. A request first stored before 2026-09-29 has no fingerprint and replays even a changed request. The text is replayed only while OCR history is retained: with history off a replayed success has a null extracted_text and a warning that the text was not retained, so clients with history off must keep the first response. Use a fresh key for every distinct document. Without this header the call fails with 400 (Idempotency-Key header is required).
enginestringYesEngine ID, e.g. "mistral-mistral-ocr-4-1". See GET /v1/engines.
inputobjectYesThe document to process.
input.typestringYesInput type: "url" or "base64". Other values, including "file", are rejected.
input.urlstringIf type=urlPublic URL of the document.
input.data_base64stringIf type=base64Raw base64-encoded document data. Do not include a data: URI prefix (it is rejected as invalid base64).
input.mime_typestringNoMIME type hint for base64 input (e.g. "image/png").
options.language_hintsstring[]NoLanguage hints, e.g. ["eng", "fra"], honored by OpenOCR-hosted engines. Prefer settings.language.
options.detect_tablesbooleanNoEnable table detection where the engine supports it.
pdf_routingobjectNoPer-page PDF control on /v1/ocr (sync or async). Fields: mode (auto, ocr, file_text; default auto), needs_ocr (ocr, skip, error; default ocr), pictures (read, ignore, large; default read), ocr_engine (request engine only), overrides ([{pages: "1,3-5", action: "ocr" | "file_text" | "skip"}]; default []). Overrides win. needs_ocr skip/error applies to missing, hidden, covered, unreadable or complex-script text and failed OCR checks; picture, annotation, drawing and short-text pages still use OCR. Auto and file_text require the PDF text layer: detect_tables, document_context/transcription instructions, structure engines or an unavailable reader cause 422 before charging. mode ocr without overrides needs no text layer. page_count up to 1,000 and within the engine max_pages limit; most engines, including LLM engines, accept only one page. Over 20 pages on an image-only engine it runs as a background job (poll /v1/ocr/jobs/{job_id}/status). Not supported yet with native-PDF engines, serverless background processing, non-PDF input, settings.page_range, a different OCR engine, request-level fallback, or /v1/ocr/batch. Batch-only engines cannot use this endpoint. See /docs/pdf-routing for examples, pricing and errors.
fallback_enginestringNoDeprecated alias for pdf_routing.ocr_engine. Validated but has no effect without pdf_routing. With it, must name the request engine; a different engine is not supported yet (400).
scanned_handlingstringNoDeprecated alias for pdf_routing.needs_ocr: "skip" maps to skip, "fallback" to ocr, "error" to error. Validated but has no effect without pdf_routing. Conflicting alias values return 400. "fallback" without fallback_engine returns 422.
fallbackobject | string | booleanNoOpt-in retry on another engine; nothing is retried unless you send it. {"engine": "<engine id>", "on": [...]} retries once on the engine you name, only in the cases you list: provider_refused, provider_empty, provider_timeout, engine_unavailable, output_limit_reached, output_loop (default ["provider_refused", "provider_empty"]). That engine must pass the same checks as engine, or the request is a 400 before any charge. Each attempt is billed as on its own: a failed attempt at what the provider charged us for it (often $0), the fallback at its own price, so you can pay for both; attempts lists each one. "similar" (or true) instead retries once on an engine from a different vendor that scores within 5 points on our hard benchmark and costs the same or less per page, never charged above the engine you asked for. Default "off". Not available on /v1/ocr/batch, and not for a PDF over 20 pages on an image-only engine (it runs as a page-by-page job that cannot retry elsewhere): that is a 400 before any charge, so send 20 pages or fewer or leave fallback out. An enabled fallback retry cannot be combined with pdf_routing. The deprecated fallback_engine is an alias for pdf_routing.ocr_engine and has no effect without pdf_routing.
document_contextobjectNo{ type (up to 128 characters), description (up to 4,000) }, at least one. A hint about what the document is, for engines that take instructions (instruction_capabilities.document_context in GET /v1/engines; in practice language-model engines). It only helps read ambiguous text: the model is told not to summarize, translate, correct or invent. Any other engine returns 422 unsupported_document_context before any charge. On a PDF it turns off the text layer. Also allowed on batch items.
transcriptionobjectNo{ format ("plain_text" or "markdown"), instructions (up to 4,000 characters) }, at least one. Presentation rules for the transcript, on the same engines as document_context; any other engine returns 422 unsupported_transcription. Cannot be combined with goal. Also allowed on batch items.
goalobjectNo{ preset, prompt }, at least one. preset is transcribe (the default OCR task), describe_image, extract_tables, find_regions or understand_website; prompt is your own request (prompt plus document_context at most 4,000 characters). Anything but plain transcribe replaces the OCR task, so only engines whose instruction_capabilities.goal_prompt is true take it (otherwise 422). Sync only, one base64 PNG, JPEG or static WebP image (no URL, no PDF); not with fallback, fallback_engine, max_output_tokens, transcription, output_format text, the demo key or /v1/ocr/batch (400 or 422, before any charge). Only for accounts that have paid for credit by card or auto top-up: signup and courtesy credit do not count (403 goal_requires_deposit). It holds up to $0.25 up front (instruction_capabilities.goal_hold_usd; 422 goal_hold_too_large above that) and is billed on the tokens used. At most 5 goal requests in any 24 hours may end with no charge or still be running; the sixth gets 429 goal_attempt_limit with Retry-After.
max_output_tokensintegerNoOutput allowance for this request in tokens, for language-model engines only. Default: the engine's own allowance (16,384 for models that reason before answering, 8,192 for others, never more than the model allows). Raise it, up to the model's maximum, when a dense page comes back with stop_reason "output_limit_reached"; the response names a value worth retrying with in output_limit.suggested_max_output_tokens. A value outside 1,024 to that maximum, or on an engine that is not a language model, is a 400 that names the allowed range. The allowance is also the most one page can cost, and a raised allowance raises the upfront hold.
loop_guardbooleanNoLanguage-model engines only. Default true: an answer that ends in one short piece of text repeated over and over is stopped with status "partial" and stop_reason "output_loop", and you get the text before the repetition. Send false when your page really repeats that text; the output allowance still applies.
providerobjectNoChoose which company runs the model (additive, 2026-11-05). OpenRouter's shape: order (preferred hosts), only (allow list), ignore (deny list), allow_fallbacks (default true; false makes order restrictive). Up to 20 names per list, each up to 64 characters, spelled as in served_by. Not the same as fallback, which switches to a different engine. On a direct engine, a 400 (provider_not_served) names its single host if only omits it, ignore lists it, or order omits it while allow_fallbacks is false. With allow_fallbacks absent or true, order alone is a preference and the engine runs. See #provider.
settings.dpiintegerNoResolution hint, 72 to 1200.
settings.page_rangestringNoPage selection such as "1-3,5" for engines that support it (OCRmyPDF).
settings.detect_tablesbooleanNoSame as options.detect_tables.
settings.auto_rotatebooleanNoDefault true: before the engine reads it, each image or rendered PDF page found sideways or upside down is turned upright. No extra charge. Not done for engines that handle rotation themselves (AWS Textract, Google Document AI, Mistral OCR, Datalab), engines on our serverless GPU pool, or with a goal. false sends every page as received. Also accepted as options.auto_rotate. metadata.rotation reports { enabled, pages_checked, pages_rotated, rotated_pages: [{ page, degrees_clockwise, confidence, source }] }, or { enabled: false, reason }; text and markdown output get an X-OCR-Rotated-Pages header such as "2:90".
modestringNo"sync" (default) or "async".
webhook_urlstringNoWebhook URL for async results. Needs mode="async", except a PDF request of more than 20 pages (page_count over 20, or a longer base64 PDF sent without page_count) on an engine that cannot read PDFs directly, which runs in the background and sends it too. If your balance is too low for an explicit page_count and you did not send mode="async", the count is lowered to what your credits cover, and a lowered count of 20 or fewer runs synchronously: the result is in the response and no webhook is sent. Without page_count, a base64 PDF whose whole document your balance cannot cover is refused with 402 instead.
page_countintegerNoOptional cap on the pages read, from page 1. Leave it out and a PDF sent as base64 is read whole, up to the engine's limit (max_pages_per_request in GET /v1/engines), and charged per page read. If your balance cannot cover every page, the request is refused with 402 insufficient_balance before anything is read or charged. A PDF sent by URL is not counted before it is read (nor is a PDF the router cannot parse in time), so without page_count only page 1 is read.
output_formatstringNoResponse format: "json" (default), "text" (plain text, Content-Type: text/plain), or "markdown" (Content-Type: text/markdown).
settingsobjectNoUnified engine settings. Automatically mapped to engine-native parameters.
settings.languagestringNoISO language code (e.g. "en", "ja", "zh"). Mapped to each engine's native language parameter. Default: "en".
native_settingsobjectNoEngine-specific passthrough parameters. Overrides unified settings on conflict. See engine docs for supported keys.

Response Fields

ParameterTypeRequiredDescription
request_idstringAlwaysUnique request identifier.
statusstringAlways"succeeded"; "partial" (the answer stopped early, see stop_reason); "refunded" (HTTP 202; the engine failed: cost_debited is what you were still charged, often 0 but not always); "timeout" (HTTP 503 with Retry-After, or HTTP 202 with http_status 503 and no Retry-After when the headers were already sent after about 60 seconds); "failed"; or "processing" (async, HTTP 202). GET /v1/ocr/{request_id} can also say "queued" or "rejected", and reports refunded and timeout as "failed".
enginestringAlwaysEngine ID that processed the request.
served_bystring | nullOn resultsWhich company actually processed the document. For an OpenRouter engine this is the host OpenRouter used, spelled as OpenRouter spells it (for example "DeepInfra"), or "unknown" when OpenRouter did not say. For any other engine it is that engine's own vendor (for example "google" or "mistral"). engine names the engine that produced the text: the one you chose, unless a fallback you asked for ran (see attempts) or the engine you named was retired and its replacement ran (see replacement). served_by says which company ran it. It is null when the host is unknown or was not recorded (older requests, multi-page PDF jobs where pages can be served by different hosts, and requests that ended without a result). Also returned in async job status and result, batch items, GET /v1/ocr/{request_id} and an idempotent replay. Additive: nothing else changed.
metadata.served_by_pagesobject[]When recordedOrdered source-page processing states and observed hosts. Compare with metadata.source_pages_total. See Which host processed each PDF page? below.
metadata.source_pages_totalintegerWith served_by_pagesOriginal source-page count (1–2000), used to verify the page report is complete. Omitted with the array when unavailable.
provider_errorstring | nullAlwaysWhat went wrong when status is not succeeded; null on success.
warningstringWhen applicableOne sentence the caller must see, for example why a failed request still has a non-zero cost_debited, that a fallback or a retired engine's replacement produced the text, or why a partial answer stopped.
replacementobjectWhen the engine you named was retired{ requested_engine, engine, reason (engine_retired), retired_at, note, switch_to }. The request ran on the replacement engine, at that engine's price, and engine names it. Such a response is always JSON, whatever output_format asked for. Change your engine to switch_to to stop seeing it.
attemptsobject[]When a fallback was involvedEvery engine tried, in order: { engine, outcome (succeeded, failed or skipped), error_code, cost_usd }. cost_usd is what that attempt cost you; the entries add up to cost_debited.
extracted_textstringOn successFull extracted text content.
extracted_text_previewstringOn successTruncated preview of extracted text.
pagesintegerOn successNumber of pages processed.
pages_totalintegerWhen knownNumber of pages in the source document. Omitted when the router cannot tell (for example a single image URL). If it is larger than pages, only part of the document was processed: because of page_count or the engine's max_pages limit, or because a URL input is not counted before it is read.
warningsstring[]When applicableNon-fatal notes, for example "document has 3 pages; processed 1. A read stops at page_count when one is sent, and at the engine's max_pages; ..." Check it when you send a multi-page PDF.
poll_urlstringAsync onlyPath to poll for the result, /v1/ocr/{request_id}. Returned with status "processing".
cost_debitednumberAlwaysCredits charged (USD). Non-zero on a failed request when the engine ran and the provider billed us for the attempt; 0.0 when nothing is owed. See Billing on Errors.
provider_latency_msintegerOn successEngine processing time in milliseconds.
confidencenumberOn successOCR confidence score (0–1). Present when the engine supports it (e.g. Tesseract, EasyOCR). Absent for engines like OCRmyPDF.
applied_settingsobjectOn successEchoes the actual settings applied to the engine, including language mapping and any native overrides.

Which host processed each PDF page?

JSON results can include metadata.served_by_pages entries with page_number, state and served_by. Compare the array length with metadata.source_pages_total: every original source page must appear once, in order from 1 through that count, including pages outside page_count. Reports are limited to 1–2000 source pages. Older results or unknown source-page counts may omit both fields.

The states are provider_success, provider_failed, text_layer, skipped, not_requested and unrecorded. Only provider_success can carry a host: the actual OpenRouter host or direct vendor. unknown means a successful OpenRouter reply did not name a usable host; null means host evidence is unavailable. Successful empty replies still record their host. Local PDF text extraction and pages never sent to a provider do not.

For a complete served_by_pages report, the document-level served_by names a host only when every source page has provider_success with the same recorded host; otherwise it is null. Native-PDF and older whole-document results can still carry served_by without a per-page report. That scalar alone does not identify each page's host. Do not use a host from one reported page to describe the whole document.

This additive field is JSON-only. For async jobs, read /result; progress /status keeps its existing scalar field without the page array. Existing history-off and expiry rules still apply: this does not restore deleted results. Text/markdown bodies, headers and ordinary webhooks do not include this array.

bash
# POST /v1/ocr
curl -X POST https://api.open-ocr.com/v1/ocr \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-ocr-your-api-key" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "engine": "mistral-mistral-ocr-4-1",
    "input": {
      "type": "url",
      "url": "https://example.com/document.png"
    }
  }'

# Response (HTTP 200 for JSON output; still check the status field):
# {
#   "request_id": "req_abc123",
#   "status": "succeeded",
#   "engine": "mistral-mistral-ocr-4-1",
#   "extracted_text": "Extracted text content...",
#   "extracted_text_preview": "Extracted text con...",
#   "pages": 1,
#   "cost_debited": 0.004,
#   "provider_latency_ms": 150
# }
python
import uuid
import requests

response = requests.post(
    'https://api.open-ocr.com/v1/ocr',
    headers={
        'Content-Type': 'application/json',
        'Authorization': 'Bearer sk-ocr-your-api-key',
        'Idempotency-Key': str(uuid.uuid4()),
    },
    json={
        'engine': 'mistral-mistral-ocr-4-1',
        'input': {
            'type': 'url',
            'url': 'https://example.com/document.png',
        },
    },
)
response.raise_for_status()  # an error envelope has no "status" field
data = response.json()
if data["status"] != "succeeded":
    raise RuntimeError(f"OCR ended as {data['status']}: {data.get('provider_error')}")
print(data['extracted_text'])
javascript
const response = await fetch('https://api.open-ocr.com/v1/ocr', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer sk-ocr-your-api-key',
    'Idempotency-Key': crypto.randomUUID(),
  },
  body: JSON.stringify({
    engine: 'mistral-mistral-ocr-4-1',
    input: {
      type: 'url',
      url: 'https://example.com/document.png',
    },
  }),
});
const data = await response.json();
if (data.status !== "succeeded") throw new Error("OCR ended as " + (data.status ?? data.error?.code)); // error envelopes have no status
console.log(data.extracted_text);
Try it live
Run OCR on a document

Error Responses

bash
# All errors use a nested envelope: { "error": { "code", "message" } }

# 401 Unauthorized — missing or invalid API key
# { "error": { "code": "authentication_error", "message": "Invalid API key" } }

# 402 Payment Required — insufficient credits
# { "error": { "code": "insufficient_balance", "message": "Insufficient balance to process any pages. Need $0.004, have $0.0001" } }

# 400 Bad Request — invalid engine or input
# { "error": { "code": "unknown_engine", "message": "'mistral-ocr-4-1' is not a known engine id. Did you mean: mistral-mistral-ocr-4-1?", "suggestions": ["mistral-mistral-ocr-4-1"] } }

# 429 Rate Limited
# { "error": { "code": "rate_limited", "message": "Rate limit exceeded" } }

Settings & Language

Use settings to pass unified parameters that work across all engines. The router automatically maps them to each engine's native format. Use native_settings for engine-specific passthrough — native settings override unified settings on conflict.

Unified Language Setting

bash
# Set language to Japanese. Honored by OpenOCR-hosted engines such as local-tesseract.
# Some engines, including Mistral OCR, ignore language hints and detect the language automatically.
curl -X POST https://api.open-ocr.com/v1/ocr \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-ocr-your-api-key" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "engine": "local-tesseract",
    "input": { "type": "url", "url": "https://example.com/japanese-doc.png" },
    "settings": { "language": "ja" }
  }'

# Response includes applied_settings showing what was mapped:
# {
#   "request_id": "req_xyz789",
#   "status": "succeeded",
#   "engine": "local-tesseract",
#   "extracted_text": "日本語のテキスト...",
#   "applied_settings": { "language": "ja" },
#   "cost_debited": 0.002,
#   "provider_latency_ms": 147
# }

Native Settings Passthrough

Pass engine-specific parameters directly. These are forwarded to the engine without transformation. If both settings and native_settings are provided, native settings win on conflict.

bash
# Tesseract-specific: set page segmentation mode
curl -X POST https://api.open-ocr.com/v1/ocr \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-ocr-your-api-key" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "engine": "local-tesseract",
    "input": { "type": "url", "url": "https://example.com/table.png" },
    "settings": { "language": "en" },
    "native_settings": { "--psm": "6", "--oem": "1" }
  }'

Language Code Mapping

The router maps ISO language codes to each engine's native format automatically:

settings.languageTesseractEasyOCRLLM engines
"en"--lang eng["en"]Prompt: English
"ja"--lang jpn["ja"]Prompt: Japanese
"zh"--lang chi_sim["ch_sim"]Prompt: Chinese
"ko"--lang kor["ko"]Prompt: Korean
"ar"--lang ara["ar"]Prompt: Arabic

OCR Processing (Async)

Set mode: "async" to get a 202 Accepted immediately. Poll for results or provide a webhook_url to receive the result when processing completes.

bash
# POST /v1/ocr  (async mode)
curl -X POST https://api.open-ocr.com/v1/ocr \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-ocr-your-api-key" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "engine": "mistral-mistral-ocr-4-1",
    "mode": "async",
    "webhook_url": "https://your-server.com/webhook",
    "input": {
      "type": "url",
      "url": "https://example.com/document.png"
    }
  }'

# Response (202):
# {
#   "request_id": "req_xyz789",
#   "status": "processing",
#   "poll_url": "/v1/ocr/req_xyz789"
# }

# Poll for result:
curl https://api.open-ocr.com/v1/ocr/req_xyz789 \
  -H "Authorization: Bearer sk-ocr-your-api-key"

# Response (inspect the status field; completed results return 200):
# {
#   "request_id": "req_xyz789",
#   "status": "succeeded",
#   "extracted_text": "Full OCR text...",
#   "engine": "mistral-mistral-ocr-4-1",
#   "cost_debited": 0.004
# }
#
# If status is "partial": extracted_text is null. Read extracted_text_preview (first 2,000
# characters) and warning; the full partial text is not stored.
Try it live
Check a request or recover its saved text

Recover results after a connection timeout

Closing the tab or losing the HTTP connection does not cancel an accepted OCR request. Processing continues within the engine's execution limit, and completed text is saved. Use the same recovery endpoint for synchronous and asynchronous requests: GET /v1/ocr/{request_id}. Polling reads the saved request; it does not run OCR again or charge for another attempt.

Recovery requires saved history. In Dashboard → Settings → OCR history, you can turn retention off and remove existing results. Requests already running will also stop saving text. Their recovery endpoint returns 410 result_not_retained. Turning history back on applies to new requests and does not restore deleted results. With history off, use synchronous processing and save the live response yourself; submitting mode: "async" returns 400 history_disabled before processing starts. Reusing an idempotency key still prevents duplicate billing, but cannot restore unretained text.

  1. For long jobs, submit with mode: "async" and save the request_id from the acceptance response before you begin polling.
  2. For a synchronous request, save request_id from the JSON response or X-Request-Id from the response headers. Slow responses send this header before the final JSON body; save it even if reading the body later times out.
  3. If you received no ID, resend the identical POST body with the same Idempotency-Key. If the first request was accepted, the replay returns its ID and current status without starting a second OCR run. If it was never accepted, that submission starts it. Keep the original key until the request is resolved.
  4. Poll every few seconds while status is queued or processing. HTTP 200 only means the lookup succeeded; it does not mean OCR finished.
  5. On succeeded, read the full extracted_text. A partial result contains incomplete text, and only extracted_text_preview is stored for it (extracted_text is null): read the preview and keep its warning too. Other terminal statuses should be handled as failures using provider_error. A provider failure or execution timeout is terminal; polling does not restart it.
python
import os
import time
import requests

# Persist this ID from POST /v1/ocr; reuse it after reconnecting.
request_id = "req_xyz789"
headers = {"Authorization": f"Bearer {os.environ['OPENOCR_API_KEY']}"}
url = f"https://api.open-ocr.com/v1/ocr/{request_id}"

# This is your polling window, not a cancellation deadline for the OCR job.
stop_waiting_at = time.monotonic() + 60
while time.monotonic() < stop_waiting_at:
    try:
        response = requests.get(url, headers=headers, timeout=15)
    except requests.RequestException:
        time.sleep(5)
        continue  # Keep the same ID; do not submit a new OCR request.
    response.raise_for_status()  # 404: missing/wrong owner; 410: text not retained.
    result = response.json()
    if result["status"] in ("queued", "processing"):
        time.sleep(5)
        continue
    if result["status"] == "succeeded":
        print(result.get("extracted_text") or "")
    elif result["status"] == "partial":
        print("Incomplete result:", result.get("warning"))
        # Only the preview is stored for a partial result; extracted_text is null.
        print(result.get("extracted_text_preview") or "")
    else:
        raise RuntimeError(result.get("provider_error") or result["status"])
    break
else:
    print(f"Still waiting. Save {request_id} and check the same URL later.")

Authenticate as the account that created the request. Another account receives 404. You can also open saved text in Dashboard → Activity, including results that finished after you left the original page. For a completion callback, provide a webhook URL when submitting an asynchronous request, then fetch the full text using its request ID.

Batch OCR

Process up to 20 images in a single request. Each item can use a different engine. Items are billed independently, and a failed item follows the same rule as a single request: nothing to pay if its engine never ran, and the provider's cost for the attempt — at cost, including costs above the initial estimate — if it ran and then failed. See Billing on Errors.

Batch retry protection is active. Send an Idempotency-Keyheader (required, 1–200 bytes). Reuse it with the same parsed request body to return the original batch ID and completed results without another debit or provider submission. Reusing it with a changed body returns 409 idempotency_key_reused. Different keys create independent paid batches. Item order and explicit defaults are part of the body comparison. Base64 text is compared as supplied, so changing its whitespace or line breaks conflicts even if decoded bytes match; preserve the original parsed field values. Keys are scoped to your account, across API keys, and retained until account deletion; never recycle a key. Only a fingerprint is stored, not input files. OCR text follows your history retention settings; keep the original response when history is off. A concurrent or interrupted item returns 202: processing means pre-submission ownership; retry the same key after 60 seconds to recover an abandoned worker. Rate limits, queue capacity, temporary billing errors, and insufficient balance remain retryable under that key; resolve the cause, honor Retry-After, and retry without creating a new batch. Recovery reuses any existing debit. indeterminate means provider submission may be running or its outcome is unknown and needs reconciliation. Completed OCR rows are replayed on the next same-key retry. Its cost_debited is the recorded charge when available, not a promise of no charge. An item whose provider outcome is uncertain is never automatically resubmitted; contact support if it stays indeterminate. Use a new key only after confirming the original outcome and intentionally authorizing another paid attempt.

Request Body

ParameterTypeRequiredDescription
itemsarrayYesArray of 1 to 20 OCR requests (400 when empty or longer). Each item takes engine, input, options, page_count, max_output_tokens, loop_guard, provider, document_context and transcription, with the same meaning as on POST /v1/ocr. fallback, pdf_routing and goal (other than transcribe) are refused with 400; send those documents to POST /v1/ocr. Other POST /v1/ocr fields (settings, native_settings, output_format, mode, webhook_url) are ignored on an item.

Each result carries index, request_id, status, engine, cost_debited, provider_name, provider_latency_ms, provider_error, extracted_text and extracted_text_preview, plus served_by, pages, pages_total, warnings, warning and metadata when they apply. An item's status is succeeded, partial, refunded (its engine failed; cost_debited is what you were still charged) or failed; on a 202 it can also be processing or indeterminate (see above). The batch returns 200 otherwise.

bash
# POST /v1/ocr/batch
# Save the key and reuse it with the same body after a timeout.
IDEMPOTENCY_KEY=$(uuidgen)
curl -X POST https://api.open-ocr.com/v1/ocr/batch \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Authorization: Bearer sk-ocr-your-api-key" \
  -d '{
    "items": [
      {
        "engine": "mistral-mistral-ocr-4-1",
        "input": { "type": "url", "url": "https://example.com/page1.png" }
      },
      {
        "engine": "google-gemini-3.1-flash-lite",
        "input": { "type": "url", "url": "https://example.com/page2.png" }
      }
    ]
  }'

# Response (200):
# {
#   "batch_id": "batch_abc123",
#   "results": [
#     { "index": 0, "request_id": "req_b1", "status": "succeeded", "engine": "mistral-mistral-ocr-4-1", "extracted_text": "Page 1...", "cost_debited": 0.004 },
#     { "index": 1, "request_id": "req_b2", "status": "succeeded", "engine": "google-gemini-3.1-flash-lite", "extracted_text": "Page 2...", "cost_debited": 0.0006 }
#   ],
#   "total_cost_debited": 0.0046
# }
Try it live
Batch process multiple images

PDF Support

Engines whose accepts in GET /v1/engines includes pdf take PDF documents. Send PDFs the same way as images — via URL or base64.

  • Without page_count, a PDF sent as base64 is read whole, up to the engine's limit (max_pages_per_request in GET /v1/engines). If your balance cannot cover every page, the request is refused with 402 before anything is read.
  • Send page_count to read only the first pages. A PDF sent by URL is not counted before it is read, so send it with a URL to read more than page 1.
  • Each page the engine reads is billed separately at its per-page rate; a page answered from the PDF's embedded text is billed at the text-layer price (see PDF Support).
  • Results include the combined text from all processed pages.
bash
# Process first 5 pages of a PDF
curl -X POST https://api.open-ocr.com/v1/ocr \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-ocr-your-api-key" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "engine": "mistral-mistral-ocr-4-1",
    "page_count": 5,
    "input": {
      "type": "url",
      "url": "https://example.com/report.pdf"
    }
  }'

# Response (HTTP 200 for JSON output; still check the status field):
# {
#   "request_id": "req_pdf456",
#   "status": "succeeded",
#   "engine": "mistral-mistral-ocr-4-1",
#   "extracted_text": "Page 1 text...\n--- Page 2 ---\nPage 2 text...",
#   "pages": 5,
#   "cost_debited": 0.02,
#   "provider_latency_ms": 820
# }

Output Format

Control the response format with output_format. Default is json.

bash
# Plain text response (Content-Type: text/plain)
curl -X POST https://api.open-ocr.com/v1/ocr \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-ocr-your-api-key" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "engine": "mistral-mistral-ocr-4-1",
    "output_format": "text",
    "input": { "type": "url", "url": "https://example.com/receipt.png" }
  }'
# Response (HTTP 200): plain text (no JSON wrapper)

# Markdown response (Content-Type: text/markdown)
curl -X POST https://api.open-ocr.com/v1/ocr \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-ocr-your-api-key" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "engine": "mistral-mistral-ocr-4-1",
    "output_format": "markdown",
    "input": { "type": "url", "url": "https://example.com/receipt.png" }
  }'
# Response (HTTP 200): the markdown wrapper plus engine output (no JSON wrapper)

Confidence Score

Some engines return a confidence score (0–1) in the JSON response. This indicates how confident the engine is in the extracted text. Engines that don't support confidence (e.g. OCRmyPDF) omit the field.

bash
# JSON response with confidence
# {
#   "request_id": "req_abc123",
#   "status": "succeeded",
#   "engine": "mistral-mistral-ocr-4-1",
#   "extracted_text": "Invoice #12345...",
#   "confidence": 0.92,
#   "cost_debited": 0.004,
#   "provider_latency_ms": 340
# }

List Engines

Returns all engines with their pricing, capabilities, and availability status (available or coming_soon).

Response Fields (per engine)

ParameterTypeRequiredDescription
idstringAlwaysEngine ID, e.g. "mistral-mistral-ocr-4-1".
namestringAlwaysHuman-readable engine name.
providerstringAlwaysProvider id, lower case (for example "mistral", "openrouter").
price_per_page_usdnumberAlwaysPer-page reserve or fallback charge in USD. Token-billed engines settle from actual token usage; this is not a fixed final price.
statusstringAlways"available" or "coming_soon".
benchmarkobject | nullAlways{ hard_score, easy_score, ci, measured_at } from our benchmarks; null when the engine has not been measured. GET /v1/engines and GET /v1/models both return it.
recommendedbooleanAlwaysTrue for engines we recommend as defaults.
acceptsstring[]GET /v1/enginesInput types and formats the engine accepts. For an engine with native_pdf true the provider reads the PDF itself. For every other engine, pdf means the router rasterizes the PDF first. It recognizes a PDF only when the input is base64 with mime_type application/pdf (or data starting with the %PDF magic), or a URL whose path ends in .pdf (query string ignored). An extensionless PDF URL such as /download/123 is not detected and is sent to the engine as an image: download it and send base64, or use a .pdf URL.
max_pages_per_requestintegerGET /v1/enginesLargest page_count a single request may use, and where a read without page_count stops.
native_pdfbooleanGET /v1/enginesTrue when the provider reads the PDF itself. Otherwise the router rasterizes PDFs first (see accepts).
instruction_capabilitiesobjectGET /v1/engines{ document_context, transcription_instructions, content_formats, goal_presets, goal_prompt, goal_hold_usd, identify_then_ocr, limits }: which of document_context, transcription and goal this engine takes. goal_hold_usd is what a goal holds up front; null when the engine takes no goal.
supportsstring[]AlwaysInput transports the provider takes natively: "image_url", "image_base64", and "pdf_url"/"pdf_base64" for native-PDF engines. Use accepts for what the API takes after router preprocessing.
max_pagesintegerAlwaysSame value as max_pages_per_request.
batch_onlybooleanWhen trueThe engine only runs through Workbench batches; POST /v1/ocr refuses it. Omitted when false.

Add ?sort=accuracy to order the list by hard-corpus benchmark score, best first. Engines with a null benchmark come last.

bash
# GET /v1/engines
curl https://api.open-ocr.com/v1/engines \
  -H "Authorization: Bearer sk-ocr-your-api-key"

# Response:
# {
#   "object": "list",
#   "data": [
#     {
#       "id": "mistral-mistral-ocr-4-1",
#       "name": "Mistral OCR 4.1",
#       "provider": "mistral",
#       "price_per_page_usd": 0.004,
#       "status": "available",
#       "supports": ["image_url", "image_base64", "pdf_url", "pdf_base64"],
#       "max_pages": 1000,
#       "accepts": ["image", "pdf"],
#       "max_pages_per_request": 1000,
#       "native_pdf": true,
#       "benchmark": { "hard_score": …, "easy_score": …, "ci": …, "measured_at": "…" },
#       "recommended": true
#     },
#     ...
#   ]
# }
python
import requests

response = requests.get(
    'https://api.open-ocr.com/v1/engines',
    headers={'Authorization': 'Bearer sk-ocr-your-api-key'},
)
engines = response.json()['data']
available = [e for e in engines if e['status'] == 'available']
print(f'{len(available)} engines available')
javascript
const response = await fetch('https://api.open-ocr.com/v1/engines', {
  headers: { 'Authorization': 'Bearer sk-ocr-your-api-key' },
});
const { data: engines } = await response.json();
const available = engines.filter(e => e.status === 'available');
console.log(`${available.length} engines available`);
Try it live
List available engines

Usage History (/v1/usage)

Lists your OCR requests with what each one was charged, newest first. Requires authentication. It does not return a balance: every JSON POST /v1/ocr result carries remaining_balance (text and markdown output carry it in the X-Remaining-Balance header), and the dashboard shows it.

Query Parameters

ParameterTypeRequiredDescription
limitintegerNoRequests per page. Default 20, at most 100; values below 1 count as 1.
offsetintegerNoRequests to skip, newest first. Default 0.
enginestringNoOnly requests to this engine ID.

Response Fields

ParameterTypeRequiredDescription
dataobject[]AlwaysYour requests, newest first: { request_id, engine_id, status, cost_debited, provider_latency_ms (null when not recorded), created_at (Postgres timestamp text, e.g. "2026-11-18 12:00:00.123+00") }. Only requests made while OCR history was on are listed; rejected requests are left out.
totalintegerAlwaysRequests matching the filter, across all pages.
limitintegerAlwaysThe page size used.
offsetintegerAlwaysThe offset used.
bash
# GET /v1/usage
curl "https://api.open-ocr.com/v1/usage?limit=20&offset=0" \
  -H "Authorization: Bearer sk-ocr-your-api-key"

# Response (200):
# {
#   "data": [
#     {
#       "request_id": "req_abc123",
#       "engine_id": "mistral-mistral-ocr-4-1",
#       "status": "succeeded",
#       "cost_debited": 0.004,
#       "provider_latency_ms": 150,
#       "created_at": "2026-11-18 12:00:00.123+00"
#     }
#   ],
#   "total": 100,
#   "limit": 20,
#   "offset": 0
# }
python
import requests

response = requests.get(
    'https://api.open-ocr.com/v1/usage',
    headers={'Authorization': 'Bearer sk-ocr-your-api-key'},
)
usage = response.json()
print(f'Requests: {usage["total"]}')
for item in usage['data']:
    print(item['request_id'], item['status'], item['cost_debited'])
javascript
const response = await fetch('https://api.open-ocr.com/v1/usage', {
  headers: { 'Authorization': 'Bearer sk-ocr-your-api-key' },
});
const usage = await response.json();
console.log(`Requests: ${usage.total}`);
for (const item of usage.data) console.log(item.request_id, item.status, item.cost_debited);
Try it live
List your recent requests

Usage History (/api/usage)

Returns paginated per-user usage history with date and engine filters. This is a dashboard endpoint on open-ocr.com/api/usage. Preferred authentication is Authorization: Bearer <api_key>.

Deprecation notice: Query-string auth viaapi_key=...is supported only as a fallback for existing clients and will be removed in a future release. Migrate to header auth now.

Query Parameters

ParameterTypeRequiredDescription
user_idstringYesUser UUID for the usage timeline query.
fromstring (YYYY-MM-DD)NoStart date. Defaults to 30 days ago.
tostring (YYYY-MM-DD)NoEnd date. Defaults to today.
enginestringNoOptional engine filter (e.g. mistral-mistral-ocr-4-1).
pageintegerNoPage number (1-indexed). Default: 1.
per_pageintegerNoResults per page. Default: 50, max: 100.
bash
# Preferred (header auth)
curl "https://open-ocr.com/api/usage?user_id=YOUR_USER_ID&page=1&per_page=50" \
  -H "Authorization: Bearer sk-ocr-your-api-key"

# Migration fallback only (deprecated)
# curl "https://open-ocr.com/api/usage?user_id=YOUR_USER_ID&api_key=sk-ocr-your-api-key"

Rate Limits

POST /v1/ocr, POST /v1/ocr/batch, GET /v1/usage and engine warm-up share a limit of 300 requests per sliding 60 seconds per API key (a batch counts once). POST /v1/ocr and GET /v1/usage responses carry the headers below so you can throttle before hitting 429s; a batch sends them only on its 429. Polling a result is not limited.

Header Reference

HeaderMeaningHow to use it
X-RateLimit-LimitTotal requests allowed in the current 60s window.Use as your hard per-minute cap.
X-RateLimit-RemainingRequests left before limit is reached.Slow down when this drops below ~5.
X-RateLimit-ResetAlways 60 (the window length) on an allowed request; on a 429, seconds until a slot frees.On a 429, sleep this long. Do not read it as a countdown on allowed requests.
Retry-AfterSeconds to wait for a transient rate-limit 429; absent on monthly key-limit errors.Always prefer this over hardcoded waits.

429 Handling (copy/paste)

bash
#!/usr/bin/env bash
set -euo pipefail

API_KEY="sk-ocr-your-api-key"
idempotency_key=$(uuidgen)  # keep this key across retries of the same request
response_headers=$(mktemp)
response_body=$(mktemp)
trap 'rm -f "$response_headers" "$response_body"' EXIT
attempt=0

while true; do
  status=$(curl -sS -o "$response_body" -D "$response_headers" -w "%{http_code}"     -X POST https://api.open-ocr.com/v1/ocr     -H "Authorization: Bearer $API_KEY"     -H "Content-Type: application/json"     -H "Idempotency-Key: $idempotency_key"     -d '{"engine":"mistral-mistral-ocr-4-1","input":{"type":"url","url":"https://example.com/doc.png"}}')

  if [ "$status" = "429" ]; then
    error_code=$(python3 -c 'import json,sys; print(json.load(sys.stdin).get("error", {}).get("code", ""))' < "$response_body" 2>/dev/null || true)
    if [ "$error_code" = "api_key_limit_reached" ]; then
      cat "$response_body" >&2  # use another key; positive limits reset next UTC month, zero does not
      exit 1
    fi
    attempt=$((attempt + 1))
    if [ "$attempt" -ge 3 ]; then cat "$response_body" >&2; exit 1; fi
    retry_after=$(awk 'tolower($1)=="retry-after:" {print $2}' "$response_headers" | tr -d '\r')
    sleep "${retry_after:-2}"
    continue
  fi

  cat "$response_body"
  break
done

Idempotency & Safe Retries

For POST /v1/ocrand POST /v1/ocr/batch, send a unique Idempotency-Key per logical operation. It is required: without it the request is refused with 400 invalid_request (batch keys are 1 to 200 bytes). If the network fails mid-request, retry with the same key to prevent duplicate charges: the same key with the same request replays the stored outcome without running or charging again, and the same key with a different request returns 409 idempotency_key_reused. Keys belong to your account, so two API keys of one account share them. A stored timeout replays as the same 503, so start a new attempt with a new key.

  • Generate one key when the user clicks “Run OCR”.
  • Reuse that key for all retries of that same attempt.
  • Generate a new key only when the user intentionally starts a new OCR run.
bash
# One key per logical request
IDEMPOTENCY_KEY="ocr-$(uuidgen | tr '[:upper:]' '[:lower:]')"

curl -X POST https://api.open-ocr.com/v1/ocr   -H "Authorization: Bearer sk-ocr-your-api-key"   -H "Content-Type: application/json"   -H "Idempotency-Key: $IDEMPOTENCY_KEY"   -d '{
    "engine": "mistral-mistral-ocr-4-1",
    "input": {"type": "url", "url": "https://example.com/invoice.png"}
  }'

Timeout & Backoff Recommendations

Set explicit client timeouts and retry only transient failures.

Request typeSuggested timeoutRetry policy
POST /v1/ocr (sync)Connect 5s, total 515sRetry transient 429/500/502/503 up to 3 times; stop on monthly key quota
POST /v1/ocr (async)Connect 5s, total 30sSame retry set; then poll by request_id
GET polling endpointsConnect 5s, total 20sBack off 1s → 2s → 4s (max 10s)
python
import random
import time
import uuid
import requests

TRANSIENT = {429, 500, 502, 503}

def post_ocr_with_backoff(payload, api_key, idem_key, max_retries=3):
    # A longer client wait does not extend server execution.
    # For longer jobs, send mode="async" and poll the returned request_id.
    for attempt in range(max_retries + 1):
        resp = requests.post(
            "https://api.open-ocr.com/v1/ocr",
            json=payload,
            headers={
                "Authorization": f"Bearer {api_key}",
                "Idempotency-Key": idem_key,
            },
            timeout=(5, 515),  # connect 5s, read 515s: above the 480s sync cap + 10s handler backstop; default cap is 240s
        )

        if resp.status_code == 429:
            try:
                error_code = resp.json().get("error", {}).get("code")
            except (ValueError, AttributeError):
                error_code = None  # proxy may return HTML
            if error_code == "api_key_limit_reached":
                return resp  # monthly key quota: backoff cannot make this key usable now
        if resp.status_code not in TRANSIENT:
            return resp

        if resp.status_code == 503 and resp.json().get("status") == "timeout":
            return resp  # stored timeout: the same key returns the same 503, so do not retry it

        if attempt == max_retries:
            return resp

        if resp.status_code == 429 and resp.headers.get("Retry-After"):
            delay = float(resp.headers["Retry-After"])
        else:
            delay = min(2 ** attempt, 10) + random.uniform(0, 0.25)
        time.sleep(delay)

    return resp

payload = {"engine": "mistral-mistral-ocr-4-1", "input": {"type": "url", "url": "https://example.com/doc.png"}}
api_key = "sk-ocr-your-api-key"
resp = post_ocr_with_backoff(payload, api_key, str(uuid.uuid4()))

# Use it: HTTP 2xx only means the call completed. Check the body status.
body = resp.json()
if body.get("status") == "timeout":
    # A timed-out request replays as the same 503 for this key, forever. Report it, or start a
    # NEW attempt with a NEW Idempotency-Key. Never loop on the same key.
    raise RuntimeError("OCR timed out; retry with a NEW Idempotency-Key")
if not resp.ok:
    # Error envelope: {"error": {"code", "message"}} with no "status" field, for example
    # 409 idempotency_key_reused (the key was used with a different request).
    err = body.get("error", {})
    raise RuntimeError(f"HTTP {resp.status_code} {err.get('code')}: {err.get('message')}")
if body["status"] != "succeeded":
    raise RuntimeError(f"OCR ended as {body['status']}: {body.get('provider_error')}")
print(body["extracted_text"])

For detailed error-by-error remediation, see the Error Codes page.

Health Check & Status

Two endpoints for monitoring. Neither requires authentication for basic checks.

bash
# GET /v1/health — health check (also at /health)
curl https://api.open-ocr.com/v1/health

# Response (200; 503 with "ok": false when the catalog is empty or the database does not answer):
# {
#   "ok": true,
#   "webhook_signature_version": 2,
#   "checks": { "catalog": "ok", "database": "ok" },
#   "engine_count": 146,
#   "local_engine_concurrency": [ ... ]
# }

# GET /v1/status — service status (unauthenticated)
curl https://api.open-ocr.com/v1/status

# Response (200):
# {
#   "ok": true,
#   "engine_count": 20
# }

# GET /v1/status — full details (authenticated)
curl https://api.open-ocr.com/v1/status \
  -H "Authorization: Bearer sk-ocr-your-api-key"

# Response (200):
# {
#   "ok": true,
#   "engine_count": 20,
#   "version": "0.1.0",
#   "uptime_seconds": 86400
# }
python
import requests

# Basic check (no auth)
status = requests.get('https://api.open-ocr.com/v1/status').json()
print(f'OK: {status["ok"]}, Engines: {status["engine_count"]}')

# Full details (with auth)
status = requests.get(
    'https://api.open-ocr.com/v1/status',
    headers={'Authorization': 'Bearer sk-ocr-your-api-key'},
).json()
print(f'Version: {status["version"]}, Uptime: {status["uptime_seconds"]}s')
javascript
// Basic check (no auth)
const status = await fetch('https://api.open-ocr.com/v1/status')
  .then(r => r.json());
console.log(`OK: ${status.ok}, Engines: ${status.engine_count}`);

// Full details (with auth)
const full = await fetch('https://api.open-ocr.com/v1/status', {
  headers: { 'Authorization': 'Bearer sk-ocr-your-api-key' },
}).then(r => r.json());
console.log(`Version: ${full.version}`);
Try it live
No auth required

Engine Health

Health check that probes all local engine endpoints. Returns per-engine health status and in-memory performance metrics. The result is cached for 30 seconds. No authentication required.

bash
# GET /v1/engines/health
curl https://api.open-ocr.com/v1/engines/health

# Response (200):
# {
#   "object": "engine_health",
#   "total": 5,
#   "healthy": 4,
#   "engines": [
#     {
#       "engine_id": "local-tesseract",
#       "engine_name": "Tesseract OCR",
#       "health_url": "http://localhost:8101/health",
#       "status": "healthy",
#       "detail": null,
#       "metrics": {
#         "total_requests": 1024,
#         "window_size": 100,
#         "success_rate": 0.98,
#         "answered_rate": 0.97,
#         "empty_rate": 0.01,
#         "avg_latency_ms": 166,
#         "p50_latency_ms": 145,
#         "p95_latency_ms": 320,
#         "p99_latency_ms": 580
#       }
#     }
#   ]
# }
Try it live
Check all engine health

Engine Stats

Aggregated performance statistics from the database. Available for all engines or a specific engine. No authentication required.

bash
# GET /v1/engines/stats — all engines
curl https://api.open-ocr.com/v1/engines/stats

# Response (200):
# {
#   "object": "list",
#   "data": [
#     {
#       "engine_id": "mistral-mistral-ocr-4-1",
#       "provider_id": "mistral",
#       "total_requests": 5230,
#       "total_errors": 104,
#       "avg_latency_ms": 166.0,
#       "uptime_pct": 99.8,
#       "last_success_at": "2026-02-28 05:30:00+00",
#       "last_error_at": "2026-02-27 11:02:00+00"
#     }
#   ]
# }

# GET /v1/engines/:engine_id/stats — specific engine
curl https://api.open-ocr.com/v1/engines/mistral-mistral-ocr-4-1/stats

# Response (200): same fields as above for one engine
# Returns 404 if engine has no recorded stats
Try it live
Get all engine stats

Engine Latency History

Hourly latency time-series for a specific engine. Useful for monitoring performance trends. No authentication required.

Query Parameters

ParameterTypeRequiredDescription
hoursintegerNoHours of history to return. Default: 168 (7 days). Max: 720 (30 days).
bash
# GET /v1/engines/:engine_id/latency?hours=48
curl "https://api.open-ocr.com/v1/engines/mistral-mistral-ocr-4-1/latency?hours=48"

# Response (200):
# {
#   "engine_id": "mistral-mistral-ocr-4-1",
#   "hours": 48,
#   "data": [
#     {
#       "bucket_hour": "2026-02-27T10:00:00Z",
#       "request_count": 42,
#       "p50_ms": 145,
#       "p95_ms": 310,
#       "p99_ms": 580,
#       "error_count": 1
#     }
#   ]
# }

Engine Uptime History

Daily uptime history for a specific engine. Shows health check totals and uptime percentage per day. No authentication required.

Query Parameters

ParameterTypeRequiredDescription
daysintegerNoDays of history to return. Default: 30. Max: 365.
bash
# GET /v1/engines/:engine_id/uptime?days=7
curl "https://api.open-ocr.com/v1/engines/mistral-mistral-ocr-4-1/uptime?days=7"

# Response (200):
# {
#   "engine_id": "mistral-mistral-ocr-4-1",
#   "days": 7,
#   "overall_uptime_pct": 99.85,
#   "total_checks": 672,
#   "data": [
#     {
#       "date": "2026-02-27",
#       "checks_total": 96,
#       "checks_healthy": 96,
#       "uptime_pct": 100.0
#     }
#   ]
# }

API Changelog

Programmatic access to API version history. Useful for monitoring breaking changes. No authentication required.

bash
# GET /v1/changelog
curl https://api.open-ocr.com/v1/changelog

# Response (200):
# {
#   "api_version": "2026-02-28",
#   "changelog": [
#     {
#       "version": "2026-11-05",
#       "date": "2026-11-05",
#       "changes": [
#         "Additive: responses now include served_by, which company actually processed the document. ..."
#       ]
#     },
#     ...
#   ]
# }
Try it live
View API version history