OCR
Extract Markdown and page layout from a PDF or image.
Before You Begin
OCR converts document pages into text and layout information. Use it to make scanned material searchable or to prepare documents for a downstream application.
Complete the quickstart. You need an enabled OCR model, ocr.write, and available workspace credits. Prepare an inline base64 PDF or supported raster image; remote URLs and provider file IDs are not accepted.
Prepare the Document
For a PDF, put an application/pdf base64 data URL in document.document_url. For an image, use an image/png or image/jpeg data URL in document.image_url. Set the matching document type as shown in the reference.
Choose pages explicitly with zero-based indexes. For example, [0, 1] selects the first two pages of a PDF; an image requires [0]. Page indexes must be unique and increasing. The OCR reference defines file sizes, image dimensions, and page limits.
Extract Pages
Replace the document placeholder with your encoded file and select an enabled model. The example shows the request shape; its placeholder is not a valid PDF.
curl --fail --show-error --request POST \
--url "$AUDIOLAB_API_URL/v1/ocr" \
--header "Authorization: Bearer $AUDIOLAB_API_KEY" \
--header 'Idempotency-Key: YOUR_UNIQUE_REQUEST_ID' \
--header 'Content-Type: application/json' \
--data '{
"model": "mistral/mistral-ocr-4-1",
"document": {
"type": "document_url",
"document_url": "data:application/pdf;base64,BASE64_PDF"
},
"pages": [
0
]
}'A successful response contains pages. Each page can include its index, Markdown, dimensions, and image information. usage_info.pages_processed reports the provider’s processed page count.
Store the Extracted Content
Save the returned content in your application if you need to search or display it later. Output is returned once; Get OCR Status exposes processing and settlement state, not a replay of document contents.
Treat extracted Markdown as document content when rendering or passing it to another model. Review the extracted text and layout when exact fidelity matters. To add semantic search, continue with Embeddings.