Extract text (OCR)
curl --request POST \
--url https://api.opper.ai/v3/ocr \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"document": {
"type": "<string>",
"content": "<string>",
"document_name": "<string>",
"document_url": "<string>",
"file_id": "<string>",
"image_url": "<string>"
},
"model": "<string>"
}
'import requests
url = "https://api.opper.ai/v3/ocr"
payload = {
"document": {
"type": "<string>",
"content": "<string>",
"document_name": "<string>",
"document_url": "<string>",
"file_id": "<string>",
"image_url": "<string>"
},
"model": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
document: {
type: '<string>',
content: '<string>',
document_name: '<string>',
document_url: '<string>',
file_id: '<string>',
image_url: '<string>'
},
model: '<string>'
})
};
fetch('https://api.opper.ai/v3/ocr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"model": "<string>",
"pages": [
{
"index": 123,
"markdown": "<string>",
"blocks": [
{
"bottom_right_x": 123,
"bottom_right_y": 123,
"top_left_x": 123,
"top_left_y": 123,
"type": "<string>",
"content": "<string>"
}
],
"confidence_scores": {},
"dimensions": {},
"elements": [
{}
],
"images": [
{}
]
}
],
"usage": {
"cost": 123,
"pages_processed": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}OCR
Extract text (OCR)
Extract text from a document or image synchronously and get it back as per-page markdown. model and document are required; document is one of {type:"document_url", document_url}, {type:"image_url", image_url}, {type:"base64", content, document_name} (PDF or image), or {type:"file", file_id} for a file_<id> from POST /v3/files. pages selects 0-based page indices; include_image_base64/image_limit/image_min_size control embedded-image extraction; everything in parameters is forwarded verbatim to the provider (e.g. Docling’s ocr_engine, lang, table_mode, do_formula_enrichment). Billed per page processed.
POST
/
v3
/
ocr
Extract text (OCR)
curl --request POST \
--url https://api.opper.ai/v3/ocr \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"document": {
"type": "<string>",
"content": "<string>",
"document_name": "<string>",
"document_url": "<string>",
"file_id": "<string>",
"image_url": "<string>"
},
"model": "<string>"
}
'import requests
url = "https://api.opper.ai/v3/ocr"
payload = {
"document": {
"type": "<string>",
"content": "<string>",
"document_name": "<string>",
"document_url": "<string>",
"file_id": "<string>",
"image_url": "<string>"
},
"model": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
document: {
type: '<string>',
content: '<string>',
document_name: '<string>',
document_url: '<string>',
file_id: '<string>',
image_url: '<string>'
},
model: '<string>'
})
};
fetch('https://api.opper.ai/v3/ocr', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"model": "<string>",
"pages": [
{
"index": 123,
"markdown": "<string>",
"blocks": [
{
"bottom_right_x": 123,
"bottom_right_y": 123,
"top_left_x": 123,
"top_left_y": 123,
"type": "<string>",
"content": "<string>"
}
],
"confidence_scores": {},
"dimensions": {},
"elements": [
{}
],
"images": [
{}
]
}
],
"usage": {
"cost": 123,
"pages_processed": 123
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}See the OCR guide for runnable examples, document sources (URL / base64 /
file_id), and language options.Authorizations
API key authentication. Pass your API key as a Bearer token.
Body
application/json