Run OCR on a document or image
Runs layout-aware OCR on the provided document bytes and returns per-page results. When a page range is provided, only the inclusive subset is processed. Requires OCR_DOCUMENT permission.
x-api-key<token>
In: header
OCR request payload
contentstring | null
Base64-encoded document bytes
format?OcrInputFormat
Input format hint (AUTO, PDF, TIFF, PNG, JPEG, BMP)
Value in
"AUTO" | "PDF" | "TIFF" | "PNG" | "JPEG" | "BMP"includeRawJson?boolean | null
Include raw OCR JSON payload in the response
includeMarkdown?boolean | null
Include markdown rendering in the response
startPage?integer | null
0-based inclusive start page
Format
int32endPage?integer | null
0-based inclusive end page
Format
int32Response Body
curl -X POST "http://localhost:8080/v1/ocr:document" \ -H "Content-Type: application/json" \ -d '{ "content": "JVBERi0xLjQKJcTl8uXr...", "format": "PDF", "includeRawJson": "true", "includeMarkdown": "true", "startPage": "0", "endPage": "4" }'{
"detectedFormat": "PDF",
"pageCount": "12",
"pages": [
{
"pageIndex": "0",
"page": {
"rawJson": "[{\"text\":\"Example\"}]",
"markdown": "# Heading",
"layout": {
"cells": [
{
"bbox": {
"x1": "12.5",
"y1": "34.7",
"x2": "210.2",
"y2": "98.3"
},
"categoryLabel": "section-header",
"category": "UNSPECIFIED",
"text": "Introduction"
}
]
},
"timings": {
"queueWaitMs": "15",
"renderMs": "42",
"ocrMs": "118",
"totalMs": "175"
},
"image": {
"widthPx": "2150",
"heightPx": "2575",
"dpi": "200"
}
},
"status": {
"code": "13",
"message": "OCR request failed for page 3"
}
}
],
"timings": {
"wallTimeMs": "14324",
"sumQueueWaitMs": "3959255",
"sumRenderMs": "14005",
"sumOcrMs": "50987",
"sumPageTotalMs": "4024248"
}
}Empty
Empty
Empty
Empty
Empty