OCRRouter

Amazon Textract API docs

How OCRRouter calls Amazon Textract, what the upstream returns field by field, and how that becomes Markdown and JSON blocks.

Overview

Amazon Textract AnalyzeDocument with the LAYOUT feature, reached through OpenParser. It returns layout blocks (title, section header, text, table, figure), lines and words with 0 to 100 confidence.

OCRRouter turns OpenParser's openparser@1 output into per-page Markdown plus layout blocks. Textract boxes are page ratios, so bbox values are in the normalized unit (0 to 1).

Price and limits

Model ID
aws/textract
Price
25 credits / page ($25 per 1,000 pages)
Max pages per request
3,000
Inputs
PDF; Images (JPEG, PNG, TIFF per AWS)
Languages
40+ languages for text and Layout, including 32 EU languages, Arabic, Chinese, Hebrew, Hindi, Japanese and Korean; handwriting in English only. The 6-language limit (English, Spanish, Italian, Portuguese, French, German) applies only to the Forms feature, which OCRRouter does not use
Positions (bbox)
Yes, when the upstream returns them
  • AWS: 10 MB for synchronous calls, 500 MB PDF for asynchronous calls
  • OCRRouter catalog limit: 3,000 pages

You pay only for pages that succeed. A failed attempt that falls back to another model is not charged. See pricing.

How OCRRouter calls it

Endpoint
POST https://api.openparser.dev/parse (multipart: request JSON + file)
Upstream model
OpenParser ocr_model "aws-textract-layout" (textract-analyze-document)
Auth
Bearer OpenParser API key, server side
Long jobs
HTTP 202, then poll the job until it succeeds

Options

What OCRRouter sets on the upstream call. You choose the model, format and pages in your request; vendor-specific options are not passed through.

ocr_model
"aws-textract-layout" (in the JSON request part)
output_format
"openparser@1"
Idempotency-Key
A fresh UUID per request, required by OpenParser
Client options
None. Clients cannot pass vendor options such as page ranges, features or output format.

Raw response fields

Every field the upstream documents, with its type and meaning taken from the vendor's own reference. Fields marked "read by OCRRouter" are the ones our connector uses; the rest are listed so you know what the engine produces.

What OCRRouter receives: OpenParser openparser@1

OCRRouter never calls Textract directly. OpenParser runs the vendor call and converts the vendor response to its own openparser@1 document, which is the only shape OCRRouter sees. Fields marked used are the ones OCRRouter reads.

Source: OpenParser openparser@1 schema, retrieved 2026-11-19

output_format"openparser@1"
Schema version identifier.Example: "openparser@1"
document_idstring
Stable identifier for the parsed document.
provenanceobject
Provider and model metadata: provider, model, version, operation.Example: {"provider":"aws","model":"textract-analyze-document","version":"1.0"}
textstring, read by OCRRouter
Plain text of the whole document in reading order. Spans index into it.
markdownstring, read by OCRRouter
Best-effort Markdown rendering of the whole document. Used as the fallback when elements carry no text.Example: "# Invoice 1042\n\nItem Qty"
pages[]DocumentPage[], read by OCRRouter
Coordinate space and reading order of each page.
pages[].numbernumber, read by OCRRouter
One-based page number. Numbers are contiguous.Example: 1
pages[].widthnumber, read by OCRRouter
Page width in the page's coordinate unit.
pages[].heightnumber, read by OCRRouter
Page height in the page's coordinate unit.
pages[].unit"pixel" | "point" | "inch" | "normalized", read by OCRRouter
Coordinate unit for every bbox on the page.Example: "normalized"
pages[].element_idsstring[], read by OCRRouter
IDs of all elements on the page, including lines and words.
pages[].reading_orderstring[], read by OCRRouter
Ordered subset of element_ids, limited to top-level content.
pages[].confidenceConfidence
Optional page-level OCR aggregate.
pages[].qualityPageQuality
Optional image-quality scores, defects and metrics, separate from confidence.
elements[]DocumentElement[], read by OCRRouter
Text, tables, figures and other semantic content.
elements[].idstring, read by OCRRouter
Element ID, referenced from pages[].reading_order.
elements[].kindstring, read by OCRRouter
One of text, table, figure, formula, key_value, query_answer, section, selection_mark, signature, barcode, link, stamp, other.Example: "text"
elements[].rolestring, read by OCRRouter
For text elements: heading, paragraph, line, word, page_header, page_footer and similar.
elements[].textstring, read by OCRRouter
Element text.
elements[].markdownstring, read by OCRRouter
Element text as Markdown, when provided. Read before text.
elements[].spans[]{start,end}[]
UTF-16 offsets into the document text, end exclusive.
elements[].locations[].page_numbernumber, read by OCRRouter
Page the location is on.Example: 1
elements[].locations[].bbox{left,top,right,bottom}, read by OCRRouter
Axis-aligned box in page-local coordinates; right and bottom are exclusive.
elements[].locations[].polygon{x,y}[]
Tighter outline when the source provides one.
elements[].confidence.scorenumber, read by OCRRouter
Score normalised to 0 to 1.
elements[].confidence.scopestring
What the score measures: detection, recognition, classification, geometry, answer or quality.
elements[].confidence.calibratedboolean
Defaults to false. Uncalibrated scores should not be compared across providers or scopes.
elements[].confidence.source_valuenumber
The provider's original score.
elements[].confidence.source_scalestring
Scale of the original score: zero_to_one, zero_to_hundred, log_probability or unknown.
elements[].row_countnumber, read by OCRRouter
Table rows.
elements[].column_countnumber, read by OCRRouter
Table columns.
elements[].cells[].row_indexnumber, read by OCRRouter
Cell row position.
elements[].cells[].column_indexnumber, read by OCRRouter
Cell column position.
elements[].cells[].row_spannumber
Rows the cell covers.
elements[].cells[].column_spannumber
Columns the cell covers.
elements[].cells[].textstring, read by OCRRouter
Cell text.
relations[]DocumentRelation[]
Directed links between elements, such as containment and captions.Example: {"type":"contains","from_id":"...","to_id":"..."}
text_annotations[]TextAnnotation[]
Language and style metadata over spans of text.
assets[]DocumentAsset[]
Page and figure images.

Real response captured 2026-11-19 from POST /parse on a small 600 x 260 PNG. Trimmed to the first two reading-order elements, one relation, and the first element IDs.

{"output_format": "openparser@1","document_id": "b1c4a829aacf83ef0491f8b0f0a48e5c","provenance": {"provider": "aws","model": "textract-analyze-document","version": "1.0","operation": "analyze_document"},"text": "Invoice 1042\nItem Qty\nPaper 2","markdown": "# Invoice 1042\n\nItem Qty Paper 2","pages": [{"number": 1,"source_page_number": 1,"width": 1,"height": 1,"unit": "normalized","rotation_degrees": 0,"languages": [],"element_ids": ["aws-36b7f77f-eae3-4bf9-be4a-3bb39abdfa97","aws-a41c64f1-0323-426c-a090-86e708bd1aa1","aws-bfa9feed-147b-4500-b928-683cd1f92c6f","aws-28541c05-1195-42f7-80e3-1171ac46b9b0","..."],"reading_order": ["aws-87e5982dc0b149c1abc2659297d1d4e8","aws-e261649b052444a49f992b150df7123a"]}],"elements": [{"id": "aws-87e5982dc0b149c1abc2659297d1d4e8","locations": [{"page_number": 1,"bbox": {"left": 0.0543709434568882,"top": 0.08228255063295364,"right": 0.31988343968987465,"bottom": 0.1713457852602005},"polygon": [{ "x": 0.0543709434568882, "y": 0.08228255063295364 },{ "x": 0.31988343596458435, "y": 0.08228255063295364 },{ "x": 0.31988343596458435, "y": 0.1713457852602005 },{ "x": 0.0543709434568882, "y": 0.1713457852602005 }]}],"confidence": {"score": 0.7394236755371094,"scope": "classification","calibrated": false,"source_value": 73.94236755371094,"source_scale": "zero_to_hundred"},"source": {"native_id": "87e5982dc0b149c1abc2659297d1d4e8","native_type": "LAYOUT_TITLE"},"kind": "text","role": "document_title","text": "Invoice 1042","spans": [],"languages": []},{"id": "aws-e261649b052444a49f992b150df7123a","locations": [{"page_number": 1,"bbox": {"left": 0.05144728720188141,"top": 0.2735472321510315,"right": 0.2959331274032593,"bottom": 0.5319842398166656},"polygon": [{ "x": 0.05144728720188141, "y": 0.2735472321510315 },{ "x": 0.2959331274032593, "y": 0.2735472321510315 },{ "x": 0.2959331274032593, "y": 0.531984269618988 },{ "x": 0.05144728720188141, "y": 0.531984269618988 }]}],"confidence": {"score": 0.7243893432617188,"scope": "classification","calibrated": false,"source_value": 72.43893432617188,"source_scale": "zero_to_hundred"},"source": {"native_id": "e261649b052444a49f992b150df7123a","native_type": "LAYOUT_KEY_VALUE"},"kind": "other","label": "layout_key_value","text": "Item Qty Paper 2"}],"text_annotations": [],"relations": [{"type": "contains","from_id": "aws-36b7f77f-eae3-4bf9-be4a-3bb39abdfa97","to_id": "aws-28541c05-1195-42f7-80e3-1171ac46b9b0"}],"assets": []}

The vendor's own response: Textract AnalyzeDocument

What Textract returns to OpenParser. OCRRouter never sees this JSON; it is shown so you know where the openparser@1 values come from (LAYOUT_* blocks become elements, Confidence 0 to 100 becomes confidence.score 0 to 1).

Source: Textract AnalyzeDocument API reference, retrieved 2026-11-19

AnalyzeDocumentModelVersionstring
Version of the model used to analyze the document.Example: "1.0"
DocumentMetadata.Pagesinteger
Number of pages in the document.Example: 1
Blocks[]Block[]
Items detected and analyzed in the document.
Blocks[].BlockTypestring
Kind of item: PAGE, LINE, WORD, TABLE, CELL, MERGED_CELL, KEY_VALUE_SET, SELECTION_ELEMENT, SIGNATURE, QUERY, QUERY_RESULT, TABLE_TITLE, TABLE_FOOTER, and with LAYOUT: LAYOUT_TITLE, LAYOUT_HEADER, LAYOUT_FOOTER, LAYOUT_SECTION_HEADER, LAYOUT_PAGE_NUMBER, LAYOUT_LIST, LAYOUT_FIGURE, LAYOUT_TABLE, LAYOUT_KEY_VALUE, LAYOUT_TEXT.Example: "LAYOUT_TITLE"
Blocks[].Idstring
Identifier of the block, unique within one operation.
Blocks[].Textstring
The recognized word or line.Example: "Invoice"
Blocks[].TextTypestring
HANDWRITING or PRINTED.Example: "PRINTED"
Blocks[].Confidencefloat
Confidence in the recognized text and its geometry, 0 to 100.Example: 73.94
Blocks[].Geometry.BoundingBox{Width,Height,Left,Top}
Coarse axis-aligned box, as ratios of page width and height.
Blocks[].Geometry.Polygon[]{X,Y}[]
Finer polygon around the item, as page ratios.
Blocks[].Geometry.RotationAnglenumber
Rotation of the item.
Blocks[].Relationships[].Typestring
Relationship kind, for example CHILD (a LINE to its WORDs) or VALUE.Example: "CHILD"
Blocks[].Relationships[].Idsstring[]
IDs of the related blocks.
Blocks[].RowIndexinteger
Row of a table cell; first row is 1.Example: 1
Blocks[].ColumnIndexinteger
Column of a table cell; first column is 1.Example: 1
Blocks[].RowSpaninteger
Rows a cell spans.
Blocks[].ColumnSpaninteger
Columns a cell spans.
Blocks[].EntityTypesstring[]
KEY or VALUE for forms; COLUMN_HEADER, TABLE_TITLE, TABLE_SECTION_TITLE, TABLE_FOOTER, TABLE_SUMMARY, STRUCTURED_TABLE, SEMI_STRUCTURED_TABLE for tables.
Blocks[].SelectionStatusstring
SELECTED or NOT_SELECTED for check boxes and option buttons.
Blocks[].Pageinteger
Page the block was found on; always 1 for single images.
Blocks[].Query{Alias,Pages,Text}
The query a QUERY block asked.
HumanLoopActivationOutputobject
Result of the human review evaluation, when configured.

Built from the documented AnalyzeDocument response syntax and Block reference. Values mirror the real OpenParser capture on the same test image; IDs are shortened.

{"AnalyzeDocumentModelVersion": "1.0","DocumentMetadata": { "Pages": 1 },"Blocks": [{"BlockType": "PAGE","Id": "p1","Confidence": 99.9,"Geometry": {"BoundingBox": { "Width": 1, "Height": 1, "Left": 0, "Top": 0 },"Polygon": [{ "X": 0, "Y": 0 },{ "X": 1, "Y": 0 },{ "X": 1, "Y": 1 },{ "X": 0, "Y": 1 }]},"Relationships": [{"Type": "CHILD","Ids": ["t1", "l1"]}],"Page": 1},{"BlockType": "LAYOUT_TITLE","Id": "t1","Confidence": 73.94,"Geometry": {"BoundingBox": {"Width": 0.2655,"Height": 0.0891,"Left": 0.0544,"Top": 0.0823}},"Relationships": [{"Type": "CHILD","Ids": ["l1"]}],"Page": 1},{"BlockType": "LINE","Id": "l1","Text": "Invoice 1042","Confidence": 99.8,"Geometry": {"BoundingBox": {"Width": 0.2655,"Height": 0.0891,"Left": 0.0544,"Top": 0.0823}},"Relationships": [{"Type": "CHILD","Ids": ["w1", "w2"]}],"Page": 1},{"BlockType": "WORD","Id": "w1","Text": "Invoice","TextType": "PRINTED","Confidence": 99.8,"Geometry": {"BoundingBox": {"Width": 0.17,"Height": 0.08,"Left": 0.0544,"Top": 0.0823}},"Page": 1}]}

How it maps to OCRRouter output

pages[] sorted by number
One Markdown string and one layout page per page
pages[].reading_order (else element_ids)
Block order on the page
elements[].kind + role containing table
table block
kind/role containing formula or equation
formula block
kind/role containing figure, image or picture
image block
kind/role containing heading or title
heading block, text prefixed with # (level 1 to 6)
anything else
paragraph block
elements[].markdown, else text
Block text
cells[] with row_count/column_count
GitHub Markdown table, first row as header
locations[].bbox on that page
bbox [left, top, right, bottom] in pages[].unit
pages[].width/height/unit
Layout page size and unit
confidence.score
Block confidence 0 to 1, or null
No element text on any page
Document markdown (else text) returned as page 1, no layout
HTTP 202 with job
Poll GET /jobs/{id} (or Location) with backoff 1 to 5 s until succeeded or failed
Textract LAYOUT_TITLE
OpenParser role document_title, OCRRouter heading
Textract Confidence 0 to 100
confidence.score divided by 100 (source_value keeps the original)

The unified output is described in Response format.

Example request

curl https://api.ocrrouter.ai/v1/ocr \
  -H "Authorization: Bearer $OCRROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "aws/textract",
    "file_url": "https://example.com/invoice.pdf",
    "format": "json"
  }'

Sources

Vendor documentation read on 2026-11-19.