Skip to content

Extract Document Text

POST/v1/ocr

Overview

Extract Markdown and page layout from a PDF or image using a pinned Mistral OCR model.

Routing and provider details

Requires ocr.write, credits, an Idempotency-Key, and OCR_ENABLED. Also accepts /api/v1/ocr. Integration preview until staging certification.

Send an inline base64 PDF up to 4 MiB or PNG/JPEG up to 1 MiB and 2048 pixels per side. Remote URLs and provider file IDs are not accepted. pages selects 1–32 unique, increasing, zero-based page indexes (0–999); images require [0]. The hold covers the selected page count. Final cost uses the native pages_processed count at the published rate minus 15%. Output is returned once. Reusing the idempotency key returns status without another provider call. Unknown provider outcomes retain their hold until reconciled.

Authorization

Authorizationstring · headerRequired

AudioLab API key sent as Bearer <token>. Authentication guide

Parameters

Idempotency-Keyheader · stringRequired

Request Body

application/json
providerobject

Provider preferences for a single-endpoint product.

Show nested fields
data_regionstring | string[]

Route only to endpoints documented as processing in this region: us, eu (which includes EU member states), or a country code such as nl, sg, in or cn. A list matches any of its regions. Endpoints whose region is global or unknown never match; global on its own means no requirement. The request's region narrows the workspace's Data Region and a named router's region policy, and never widens them. Fallbacks keep to it. When no endpoint qualifies, the request is refused with 400 data_region_unavailable, param provider.data_region.

Show nested fields
Option 1: string

string

Option 2: string[]

See the OpenAPI schema for this nested object.

modelstringRequired

Values: "mistral/mistral-ocr-2512""mistral/mistral-ocr-3-0""mistral/mistral-ocr-3""mistral/mistral-ocr-4-0""mistral/mistral-ocr-4-1""mistral/mistral-ocr-4""mistral/mistral-ocr-latest"

documentobject | objectRequired
Show nested fields
Option 1: object
typestringRequired
document_urlstringRequired

Inline application/pdf base64 data URL.

Option 2: object
typestringRequired
image_urlstringRequired

Inline image/png or image/jpeg base64 data URL.

pagesinteger[]Required
Show nested fields

integer

Responses

200Extracted pages and native usage.
application/json
idstringRequired
modelstringRequired
pagesobject[]Required
Show nested fields
indexinteger
markdownstring
dimensionsobject
imagesobject[]
Show nested fields

See the OpenAPI schema for this nested object.

usage_infoobjectRequired
Show nested fields
pages_processedinteger
doc_size_bytesinteger
409Existing idempotent request; native inference is not repeated.
422Unsupported or invalid document or page selection.
503Disabled route or unresolved provider outcome.
defaultThe request could not be completed.
application/json
errorobjectRequired
Show nested fields
codestringRequired
messagestringRequired
paramstring | null
request_idstring | null
metadataobject

Typed detail for some refusals. budget_exceeded (402): limit (key_budget or workspace_budget) and budget with scope, period, limit, usage and resets_at. key_limit_exceeded (402): limit key_spend_limit. access_denied (403): policy (workspace or key), rule (models, providers or products), product, provider and model.