OCR
POST /v1/ocr reads PDFs and images and returns their text as markdown, one entry per page, keeping headings, lists and tables. Use it for scanned documents, receipts, invoices, forms and screenshots, or to feed documents into a search index or a model. The model is mistral-ocr-latest, priced per page.
A PDF from a URL
curl https://api.cloakray.com/v1/ocr \
-H "Authorization: Bearer $CLOAKRAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mistral-ocr-latest",
"document": { "type": "document_url", "document_url": "https://arxiv.org/pdf/2201.04234" }
}'
An image
{
"model": "mistral-ocr-latest",
"document": { "type": "image_url", "image_url": "https://example.com/receipt.png" }
}
Both document_url and image_url take a public URL or a base64 data URL (data:application/pdf;base64,..., data:image/png;base64,...).
Only some pages
Every page processed is billed. To read part of a long document, pass pages — a list of zero-based page numbers, or a range:
{
"model": "mistral-ocr-latest",
"document": { "type": "document_url", "document_url": "https://example.com/annual-report.pdf" },
"pages": "0-4"
}
The response
{
"model": "mistral-ocr-latest",
"pages": [
{ "index": 0, "markdown": "# Annual Report 2026\n\nRevenue grew 14%..." },
{ "index": 1, "markdown": "| Quarter | Revenue |\n| --- | --- |\n| Q1 | 4.2M |" }
],
"usage_info": { "pages_processed": 2 }
}
Join the markdown of each page for the full text.
OCR or a vision model?
OCR returns faithful text at a fixed price per page, which is the better fit for bulk extraction. When you want an answer about a document — "what is the total on this invoice?" — send it to a vision model instead, or OCR it first and send the markdown.