curl https://api.portkey.ai/v1/ocr \
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
-H "x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mistral-ocr-latest",
"document": {
"type": "document_url",
"document_url": "https://example.com/document.pdf"
},
"include_image_base64": true
}'{
"pages": [
{
"index": 0,
"markdown": "# Document Title\n\nThis is the extracted text content...",
"images": [
{
"id": "<string>",
"image_base64": "<string>"
}
]
}
],
"model": "mistral-ocr-latest",
"usage_info": {
"pages_processed": 3
}
}OCR
Extract text and structured content from documents (PDFs and images) using OCR models. This endpoint provides a unified interface to document processing models from providers including Mistral AI and Azure AI Foundry.
The response contains extracted markdown content for each page, along with optional base64-encoded images of the pages.
curl https://api.portkey.ai/v1/ocr \
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
-H "x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mistral-ocr-latest",
"document": {
"type": "document_url",
"document_url": "https://example.com/document.pdf"
},
"include_image_base64": true
}'{
"pages": [
{
"index": 0,
"markdown": "# Document Title\n\nThis is the extracted text content...",
"images": [
{
"id": "<string>",
"image_base64": "<string>"
}
]
}
],
"model": "mistral-ocr-latest",
"usage_info": {
"pages_processed": 3
}
}Authorizations
Headers
An ID you can pass to refer to a span under a trace.
Link a child span to a parent span
Name for the Span ID
Pass any arbitrary metadata along with your request
Body
Request body for extracting text from documents using OCR. Supported providers include Mistral AI and Azure AI Foundry.
ID of the model to use for OCR processing. Model availability depends on the provider:
- Mistral AI:
mistral-ocr-latest,mistral-ocr-4-0 - Azure AI Foundry:
mistral-ocr-4-0,mistral-document-ai-2505,mistral-document-ai-2512
"mistral-ocr-latest"
The document to process. Specify either a URL or base64-encoded content.
Show child attributes
Show child attributes
Whether to include base64-encoded images of each page in the response.
Maximum number of pages to process. If not specified, all pages are processed.
x >= 1Minimum size (in pixels) for images to be included in the response.
x >= 1Specific page numbers to process (0-indexed). If not specified, all pages are processed.
Response
OK
Response from the OCR endpoint containing extracted content per page.
Was this page helpful?

