OCR
Extract text from PDFs and images
POST
/
v1
/
ocr
OCR
curl --request POST \
--url https://api.example.com/v1/ocrimport requests
url = "https://api.example.com/v1/ocr"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/ocr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/ocr",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/ocr"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/ocr")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/ocr")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyOverview
The OCR endpoint extracts text from documents and images, returning clean markdown. Powered by Mistral’s OCR model. Supported formats: PDF, PNG, JPEG, WebPQuick Start
curl -X POST https://api.dedaluslabs.ai/v1/ocr \
-H "Authorization: Bearer $DEDALUS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "mistral-ocr-latest",
"document": {
"type": "document_url",
"document_url": "https://arxiv.org/pdf/1706.03762"
}
}'
import httpx
import os
response = httpx.post(
"https://api.dedaluslabs.ai/v1/ocr",
headers={"Authorization": f"Bearer {os.environ['DEDALUS_API_KEY']}"},
json={
"model": "mistral-ocr-latest",
"document": {
"type": "document_url",
"document_url": "https://arxiv.org/pdf/1706.03762"
}
},
timeout=120.0
)
for page in response.json()["pages"]:
print(f"Page {page['index']}:\n{page['markdown'][:200]}...")
const response = await fetch("https://api.dedaluslabs.ai/v1/ocr", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.DEDALUS_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "mistral-ocr-latest",
document: {
type: "document_url",
document_url: "https://arxiv.org/pdf/1706.03762",
},
}),
});
const data = await response.json();
for (const page of data.pages) {
console.log(`Page ${page.index}:\n${page.markdown.slice(0, 200)}...`);
}
For local files, encode as base64 data URI:
data:application/pdf;base64, {base64_data}Response
{
"pages": [
{
"index": 0,
"markdown": "# Attention Is All You Need\n\nAshish Vaswani, Noam Shazeer...\n\n# Abstract\n\nThe dominant sequence transduction models..."
},
{
"index": 1,
"markdown": "## 1 Introduction\n\nRecurrent neural networks..."
}
],
"model": "mistral-ocr-latest"
}
Use Cases
Invoice Processing
Extract line items, totals, and dates from invoices for automated bookkeeping.Receipt Scanning
Parse receipts for expense tracking—amounts, vendors, dates extracted as structured text.Document Digitization
Convert scanned documents to searchable, editable markdown while preserving tables and formatting.Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | No | OCR model. Default: mistral-ocr-latest |
document.type | string | Yes | Always document_url |
document.document_url | string | Yes | HTTPS URL or data URI |
Limits
- Max file size: 50 MB
- Max pages: 1,000 per document
- Timeout: 120 seconds
Last modified on April 9, 2026
Was this page helpful?
⌘I
OCR
curl --request POST \
--url https://api.example.com/v1/ocrimport requests
url = "https://api.example.com/v1/ocr"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/ocr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/ocr",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/ocr"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/ocr")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/ocr")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body