Extract Document Text
/v1/ocrOverview
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.
Parameters
Idempotency-Keyheader · stringRequiredRequest Body
providerobjectProvider 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.
modelstringRequiredValues: "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 | objectRequiredShow nested fields
Option 1: object
typestringRequireddocument_urlstringRequiredInline application/pdf base64 data URL.
Option 2: object
typestringRequiredimage_urlstringRequiredInline image/png or image/jpeg base64 data URL.
pagesinteger[]RequiredShow nested fields
integer
Responses
200Extracted pages and native usage.
idstringRequiredmodelstringRequiredpagesobject[]RequiredShow nested fields
indexintegermarkdownstringdimensionsobjectimagesobject[]Show nested fields
See the OpenAPI schema for this nested object.
usage_infoobjectRequiredShow nested fields
pages_processedintegerdoc_size_bytesinteger409Existing 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.
errorobjectRequiredShow nested fields
codestringRequiredmessagestringRequiredparamstring | nullrequest_idstring | nullmetadataobjectTyped 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.