Skip to navigation

Parsing Response Format

Parse returns document content in a structure optimized for RAG, LLM context, and citation. Every run gives you both high-level formatted content and detailed block-level data with spatial coordinates. This page explains every field in the response.


Response structure

A completed parse run looks like this (truncated to a single chunk and block for brevity). The parsed content lives in output.chunks. Each chunk has a formatted content string and a blocks array of typed, layout-aware elements.

{
"object": "parse_run",
"id": "pr_3f1j6I1gsw5k96xFiCnkM",
"file": {
"object": "file",
"id": "file_GzKUy0VDhHscv7tweODYb",
"name": "bank_statement.pdf"
},
"status": "PROCESSED",
"output": {
"chunks": [
{
"object": "chunk",
"type": "page",
"content": "CHASE JPMorgan Chase Bank, N.A. P O Box 659754...",
"metadata": { "pageRange": { "start": 1, "end": 1 } },
"blocks": [
{
"object": "block",
"id": "block_WNoJ0WbMj4pRW9MpMpUox",
"type": "text",
"content": "CHASE JPMorgan Chase Bank, N.A. P O Box 659754 San Antonio, TX 78265 - 9754",
"details": {},
"metadata": { "page": { "number": 1, "width": 612, "height": 792 } },
"polygon": [
{ "x": 56.873, "y": 35.374 },
{ "x": 162.173, "y": 35.215 },
{ "x": 162.245, "y": 81.158 },
{ "x": 56.938, "y": 81.317 }
],
"boundingBox": { "left": 56.873, "top": 35.215, "right": 162.245, "bottom": 81.317 }
}
]
}
],
"metadata": {
"originalMimeType": "application/pdf",
"finalMimeType": "application/pdf",
"pages": [
{ "number": 1, "rotationApplied": 0, "originalPageWidth": 612, "originalPageHeight": 792, "dpi": 72 }
],
"languageDetected": {
"languageCode": "en",
"confidence": 0.99,
"languages": [
{ "languageCode": "en", "confidence": 0.99, "coverage": 0.82 },
{ "languageCode": "fr", "confidence": 0.98, "coverage": 0.15 }
],
"undeterminedCoverage": 0.03
}
}
},
"metrics": { "pageCount": 7, "processingTimeMs": 8293 },
"usage": { "credits": 14 },
"cacheHit": false
}

Top-level fields

FieldTypeDescription
objectstringAlways "parse_run".
idstringUnique identifier for the run (e.g. pr_...). Use it to fetch results later.
fileobject | nullThe parsed file (id, name). Reusable as input to other endpoints. To download the processed PDF, retrieve this file by ID and use its presignedUrl; see Embed OCR in PDF.
statusstringPENDING, PROCESSING, PROCESSED, or FAILED.
outputobject | nullParsed content. Present when status is PROCESSED and you did not request a URL response. Contains chunks and metadata (page rotation, original dimensions, and file type — see Reconciling coordinates against your original file — plus detected languages).
outputUrlstring | nullPresigned URL to download the same output shape as JSON. Present only with responseType=url. See Inline output vs. URL. With advancedOptions.htmlSourceAnchors, the downloaded JSON also keeps an empty polygon and an all-zero boundingBox on anchored blocks (see HTML source anchors).
metricsobjectpageCount and processingTimeMs for the run.
usageobjectCredits consumed (usage.credits).
configobjectThe full configuration used, including defaults that were applied.
failureReason / failureMessagestring | nullMachine-readable code and human-readable message. Present when status is FAILED.
cacheHitbooleanWhether this run reused parsed output. Also present on list summaries and webhook status objects. Read after completion; a hit has usage.credits: 0. See Parsed Output Caching.

Inline output vs. URL

To download the PDF produced by Embed OCR in PDF, retrieve the completed run’s file.id through Get File and use presignedUrl. outputUrl below downloads parsed JSON. The PDF download URL is not included in the run’s file summary.

By default, parsed content is returned inline in output. For large documents, the response can get big, so you can ask for a presigned download URL instead by adding the responseType=url query parameter to your parse request.

The content is embedded directly in the response body.

{
"status": "PROCESSED",
"output": { "chunks": [ /* ... */ ] },
"outputUrl": null
}

How to use it: read output.chunks directly.

Handle both shapes by checking which field is populated:

import requests
if response.output_url:
output = requests.get(response.output_url).json()
else:
output = response.output
for chunk in output["chunks"]:
print(chunk["content"])

Language detection

Every parse run reports the languages it found in the document, at output.metadata.languageDetected. Unlike the other output.metadata fields, it is populated for every supported file type, not just those with a PDF page layout.

{
"languageCode": "en",
"confidence": 0.99,
"languages": [
{ "languageCode": "en", "confidence": 0.99, "coverage": 0.82 },
{ "languageCode": "fr", "confidence": 0.98, "coverage": 0.15 }
],
"undeterminedCoverage": 0.03
}
FieldDescription
languageCodeThe language the majority of the document is written in. The languageCode of the entry in languages with the highest coverage.
confidenceHow sure the detector was about languageCode, from 0 to 1.
languagesEach language covering at least 10% of the document, ordered by coverage descending.
languages[].coverageHow much of the document is written in that language, from 0 to 1.
undeterminedCoverageHow much of the document was not attributed to any language in languages, from 0 to 1.

Undetermined text

undeterminedCoverage is the share of the document not attributed to any language in languages. Text lands there for three reasons:

  • It is numeric-only content (amounts, dates, identifiers) with no language to detect.
  • It is too short for the detector to reach a conclusion.
  • It is in a language covering less than 10% of the document. Languages with very little coverage are folded into undeterminedCoverage rather than listed to avoid noise.

When no language is detected

languageDetected is null when no reliable detection was possible. The most common cause is a document without enough text for the detector to work with: a page of bare figures, a scanned image with no extractable text, or an empty document. Numeric-only documents such as ledgers and financial tables are the typical case.

It is omitted for parse runs that completed before language detection was introduced.

metadata = response.output.metadata if response.output else None
detected = metadata.language_detected if metadata else None
if detected is None:
print("No language detected")
else:
print(f"Document language: {detected.language_code} ({detected.confidence:.2f})")
for lang in detected.languages:
print(f" {lang.language_code}: {lang.coverage:.0%} of the document")
if detected.undetermined_coverage > 0.5:
print("Warning: most of this document has no detectable language")

Language codes

languageCode is a BCP-47 code. In practice it is almost always a two-letter ISO 639-1 code such as en, fr or de, but it can carry a script subtag when a language is written in a non-native script — hi-Latn, for example, for Hindi written in the Latin alphabet. Match on the full string, or split on - to compare only the base language.


Understanding chunks

Chunks are the top-level units in output.chunks. Depending on your chunking strategy, a chunk represents a page (default), a logical section, or the whole document.

{
"object": "chunk",
"type": "page",
"content": "# Account Summary\n\n| Date | Description | Amount |\n| --- | --- | --- |\n...",
"metadata": { "pageRange": { "start": 1, "end": 1 } },
"blocks": [ /* ... */ ]
}
FieldDescription
objectAlways "chunk".
typepage, section, or document, based on your chunking strategy.
contentFully formatted content for the chunk (markdown by default), ready to drop into an LLM prompt.
metadata.pageRangeThe start and end page numbers this chunk covers (equal when the chunk is within a single page).
metadata.minOcrConfidence / avgOcrConfidenceLowest and average per-word OCR confidence for the chunk, or null when word-level confidence is unavailable.
blocksArray of block objects making up the chunk. See Understanding blocks.

content vs. blocks

Each chunk gives you two views of the same content. Pick based on what you’re building:

  • Use chunk.content when you want ready-to-use formatted text: feeding an LLM, building a RAG index, or displaying a page. Concatenate every chunk’s content to reconstruct the whole document.
  • Use chunk.blocks when you need structure or position: pulling out only tables or figures, building citations and highlights, or rendering overlays on the original document.
def extract_tables(response):
tables = []
for chunk in response.output.chunks:
for block in chunk.blocks:
if block.type == "table":
tables.append({
"content": block.content, # markdown / HTML table
"rows": block.details.row_count,
"columns": block.details.column_count,
"page_number": block.metadata.page.number,
"position": block.bounding_box,
})
return tables

Understanding blocks

Blocks are the atomic elements within a chunk: each paragraph, heading, table, figure, and key-value region is its own block, with type-specific details and spatial coordinates.

{
"object": "block",
"id": "block_WNoJ0WbMj4pRW9MpMpUox",
"type": "table",
"content": "| Date | Description | Amount |\n| --- | --- | --- |\n| 01/05 | Direct Deposit | $2,500.00 |",
"details": { "type": "table_details", "rowCount": 2, "columnCount": 3 },
"metadata": { "page": { "number": 1, "width": 612, "height": 792 } },
"polygon": [
{ "x": 61.2, "y": 158.4 },
{ "x": 550.8, "y": 158.4 },
{ "x": 550.8, "y": 356.4 },
{ "x": 61.2, "y": 356.4 }
],
"boundingBox": { "left": 61.2, "top": 158.4, "right": 550.8, "bottom": 356.4 }
}

Block fields

FieldTypeDescription
objectstringAlways "block".
idstringStable identifier, derived from the block content.
parentBlockIdstringSet only on child blocks (e.g. a table cell points to its table).
typestringThe kind of element (see Block types).
contentstringThe block’s content in the target format.
detailsobjectType-specific extra data (see Block details).
metadata.pageobjectnumber, plus page width and height. For rotation and original-dimension info, see output.metadata.pages (matched by number) under Reconciling coordinates against your original file. On anchored HTML blocks only number is set; there is no page width or height.
metadata.minOcrConfidence / avgOcrConfidencenumber | nullPer-block OCR confidence, or null when unavailable.
polygonarrayPrecise outline as { x, y } points. See Bounding box coordinates. Omitted from inline output on blocks that carry source; present as an empty array in outputUrl downloads.
boundingBoxobjectSimplified rectangle: left, top, right, bottom. Omitted from inline output on blocks that carry source; present but all zeros in outputUrl downloads.
sourceobjectByte-range anchor into the uploaded file, replacing polygon/boundingBox. Only set for HTML input when advancedOptions.htmlSourceAnchors is enabled. See HTML source anchors.
childrenarrayNested blocks (e.g. table cells when blockOptions.tables.cellBlocksEnabled is set). With advancedOptions.htmlSourceAnchors on HTML input, those cells also carry their own source anchor; htmlSourceAnchors alone does not produce cell blocks.

Block types

TypeDescription
textBody paragraphs and regular text.
headingDocument or section headings.
section_headingSubsection headings.
tableTabular data (markdown or HTML based on config).
table_head / table_cellHeader and body cells, available as child blocks of a table when cellBlocksEnabled is set on parse_performance 1.0.1. Not currently available on parse_performance 2.0.0.
figureImages, charts, diagrams, or logos.
key_valueKey-value regions such as form fields.
page_numberPage number indicators.
barcodeBarcodes and QR codes.
formulaMathematical formulas and equations.
header / footerPage headers and footers.

Block details

The details object varies by block type. It is an empty object for plain blocks by default, but some options add type-specific metadata.

Block typedetails fields
text / headingcellReference (source spreadsheet range) when Excel cell metadata is enabled.
tablerowCount, columnCount.
table_cellrowIndex, columnIndex; with Excel cell metadata enabled, cellReference and formula; with Excel cell formatting enabled, formatting.
figureimageUrl (clipped figure image), figureType (chart, image, diagram, logo, other) when classification is enabled.
formulalatex representation of the formula.
barcodedecodedValue, format (e.g. QRCode, Code128) when barcode reading is enabled.
key_valueform (a typed tree of keys, values, empty fields, signatures, and checkboxes with per-node bounding boxes) when blockOptions.keyValue.structuredOutputEnabled is set. See Form Structured Output.

Excel cell metadata and formatting

For advanced Excel parsing, advancedOptions.excelIncludeCellMetadata adds spreadsheet provenance to block details. Table cells receive details.cellReference in A1 notation (for example, "B2", or "A1:C1" for a merged cell) and formula cells receive details.formula with a leading =. Text or heading blocks that come from spreadsheet cells can receive a source range in details.cellReference.

If blockOptions.tables.targetFormat is "html", the same metadata is also emitted in table markup as data-cell and data-formula attributes. Markdown output omits those attributes, but the structured block details still carry the metadata.

advancedOptions.excelIncludeCellFormatting adds details.formatting to table cell blocks when formatting is present. The formatting object can include bold, italic, fontColor, and backgroundColor; colors are hex strings such as "#ff0000". For HTML table output, inline cell styles are also preserved.

{
"type": "table_cell",
"content": "40",
"details": {
"type": "table_cell_details",
"rowIndex": 1,
"columnIndex": 1,
"cellReference": "B2",
"formula": "=A2*10",
"formatting": {
"bold": true,
"fontColor": "#ff0000",
"backgroundColor": "#ffff00"
}
}
}

HTML source anchors

For HTML input, advancedOptions.htmlSourceAnchors anchors each block to the exact byte range it came from in the uploaded file. HTML has no page geometry, so anchored blocks carry a source object in place of polygon and boundingBox (an outputUrl download still includes an empty polygon and an all-zero boundingBox, which you should ignore). Use it to trace parsed content back to the original markup, for example for citations or highlights, since content is sanitized and cannot be sliced out of the original bytes.

With anchors enabled, each leaf block-level element (heading, paragraph, table, image, or bare text) becomes its own block of type heading, text, table, or figure. An element too large for the chunk token budget is split into several blocks, each anchored to its own piece of the markup. Works with any engine on API version 2026-02-09. SDK users need extend-ai 2.5.0+ (TypeScript), extend-ai 1.21.0+ (Python), extend-java-sdk 1.22.0+, or extend-go-sdk 0.9.0+, since earlier releases require boundingBox and polygon.

Block-level anchors

With advancedOptions.htmlSourceAnchors enabled, every block includes a source object:

{
"object": "block",
"id": "block_WNoJ0WbMj4pRW9MpMpUox",
"type": "heading",
"content": "<h1>Invoice #4471</h1>",
"details": {},
"metadata": { "page": { "number": 1 } },
"source": {
"type": "html",
"byteOffset": 118,
"byteLength": 24
}
}
FieldTypeDescription
source.typestringAlways "html" for this version of the feature.
source.byteOffsetintegerZero-based byte offset into the uploaded file where this block starts.
source.byteLengthintegerLength of this block, in bytes, starting at byteOffset.

Slicing the uploaded file’s raw bytes at [byteOffset, byteOffset + byteLength) returns the block’s original markup, including its tags. metadata.page.number is the chunk index, with no width or height. Offsets are bytes, not characters, and do not index content.

Table cells get their own anchors when blockOptions.tables.cellBlocksEnabled is also set, on any engine and version. Every cell, including <th>, is emitted as table_cell, and anchored table blocks have an empty details object.

Encoding

Byte offsets are measured in the encoding the file was decoded with, reported on output.metadata.sourceEncoding:

{
"output": {
"chunks": [ /* ... */ ],
"metadata": {
"originalMimeType": null,
"finalMimeType": null,
"pages": null,
"languageDetected": { /* ... */ },
"sourceEncoding": "utf-8"
}
}
}

originalMimeType, finalMimeType, and pages are null on these runs, and sourceEncoding is only set when advancedOptions.htmlSourceAnchors is enabled. Extend supports UTF-8 and Windows-1252 HTML. A UTF-8 byte order mark or a <meta charset> declaration in the first 1024 bytes is honored (aliases such as iso-8859-1 resolve to Windows-1252); otherwise the bytes are checked as UTF-8 and fall back to Windows-1252. A declaration is trusted over the bytes, so a mislabeled file decodes with garbled content but correct offsets. If the encoding can’t be resolved to one of the two, the run fails with UNSUPPORTED_FILE_ENCODING; see Error handling for the exact checks.

Word-level anchors

Setting advancedOptions.returnSourceNodes in addition to advancedOptions.htmlSourceAnchors adds output.source.nodes, the text-format counterpart to output.ocr.words. output.source is omitted when the file has no text:

{
"output": {
"chunks": [ /* ... */ ],
"source": {
"nodes": [
{
"content": "Invoice",
"byteOffset": 122,
"byteLength": 7,
"blockId": "block_WNoJ0WbMj4pRW9MpMpUox"
},
{
"content": "#4471",
"byteOffset": 130,
"byteLength": 5,
"blockId": "block_WNoJ0WbMj4pRW9MpMpUox"
}
]
},
"metadata": { "sourceEncoding": "utf-8" }
}
}
FieldTypeDescription
contentstringThe text of this run with HTML entities decoded, so it matches text you would see on the page (&, not &amp;).
byteOffsetintegerZero-based byte offset into the uploaded file where this run starts.
byteLengthintegerLength of this run, in bytes, starting at byteOffset.
blockIdstringThe id of the top-level block this run belongs to. Words inside a table reference the table block, not a table_cell child.

Nodes have no boundingBox or confidence. content is entity-decoded while the byte range covers the entity as written in the file, so for Jones &amp; Co the middle node has content: "&" and a byteLength of 5.

Constraints

  • advancedOptions.htmlSourceAnchors cannot be combined with advancedOptions.alwaysConvertToPdf.
  • advancedOptions.returnSourceNodes requires advancedOptions.htmlSourceAnchors.
  • Both are rejected at request validation with an HTTP 400 INVALID_REQUEST error. An unsupported encoding fails the run with UNSUPPORTED_FILE_ENCODING: an HTTP 400 on /parse, or status: "FAILED" on /parse_runs.

Confidence

Parse reports OCR confidence so you can flag regions that may need review. Both chunks and blocks expose two aggregated scores in their metadata:

FieldDescription
minOcrConfidenceThe lowest per-word OCR confidence in the chunk or block (0–1). Use it to catch the weakest text in a region.
avgOcrConfidenceThe average per-word OCR confidence across the chunk or block (0–1). A read on overall quality.

These reflect OCR confidence (how reliably the characters were recognized). Both are null when word-level confidence is unavailable.

{
"object": "chunk",
"type": "page",
"metadata": {
"pageRange": { "start": 1, "end": 1 },
"minOcrConfidence": 0.71,
"avgOcrConfidence": 0.98
}
}

A low minOcrConfidence could be used as a trigger for routing a page to manual review.


Bounding box coordinates

Before parsing, Extend automatically detects and corrects rotated or skewed pages — straightening a sideways-scanned invoice, for example — because OCR and layout detection are far more accurate on an upright page. As a result, every boundingBox and polygon below describes the position on this corrected, upright page, which may not match the orientation of the file you originally uploaded. If you need to overlay these coordinates on your own copy of the original file, see Reconciling coordinates against your original file.

Every block carries two spatial representations:

  • polygon — the precise outline of the block, as an array of { x, y } points.
  • boundingBox — a simplified, axis-aligned rectangle around the block (left, top, right, bottom).

Coordinate system

Coordinates share the page’s coordinate space, with the origin at the top-left of the page: x increases to the right and y increases downward. Every block reports the page’s own dimensions at metadata.page.width and metadata.page.height in the same units, so you can divide by them to express any position as a fraction of the page when you need normalized, resolution-independent values.

(0, 0) (pageWidth, 0)
┌────────────────────────────────────────────┐
│ (left, top) │
│ ●───────────────────────┐ │
│ │ │ │
│ │ block │ │
│ │ │ │
│ └───────────────────────● │
│ (right, bottom) │
│ │
└────────────────────────────────────────────┘
(0, pageHeight) (pageWidth, pageHeight)
FieldDescription
boundingBox.leftThe block’s left edge, measured from the left of the page.
boundingBox.topThe block’s top edge, measured from the top of the page.
boundingBox.rightThe block’s right edge, measured from the left of the page.
boundingBox.bottomThe block’s bottom edge, measured from the top of the page.
metadata.page.widthPage width, in the same units as the coordinates.
metadata.page.heightPage height, in the same units as the coordinates.

To express a position as a fraction of the page (0–1), divide each coordinate by the page dimensions: left / metadata.page.width and top / metadata.page.height.

Build highlights and overlays

Because coordinates are tied to known page dimensions, you can normalize them to whatever your viewer expects (CSS percentages, image pixels, etc.). boundingBox is optional in the block types from extend-ai 2.5.0 (TypeScript), extend-ai 1.21.0 (Python), extend-java-sdk 1.22.0, and extend-go-sdk 0.9.0 onward, since blocks parsed from HTML with advancedOptions.htmlSourceAnchors carry source instead of geometry; on earlier releases it is a required field. Skip any block without one:

def find_highlights(response, search_term):
highlights = []
for chunk in response.output.chunks:
for block in chunk.blocks:
if search_term not in block.content:
continue
page = block.metadata.page
box = block.bounding_box
if box is None:
continue # Anchored HTML blocks carry `source` instead of geometry
highlights.append({
"page_number": page.number,
# Normalized to 0–1 for resolution-independent rendering
"left": box.left / page.width,
"top": box.top / page.height,
"width": (box.right - box.left) / page.width,
"height": (box.bottom - box.top) / page.height,
})
return highlights

Reconciling coordinates against your original file

Parse runs report per-page rotation and original-dimension info on output.metadata.pages — a separate array alongside chunks, distinct from each block’s metadata.page. Match entries by page number: output.metadata.pages.find(p => p.number === block.metadata.page.number). This is set when the file is a PDF or when it was converted to a PDF.

Each entry has:

FieldDescription
rotationAppliedDegrees Extend rotated the page to make it upright, as a multiple of 90. Positive values are clockwise; negative values are counterclockwise — for example, -90 means the page was rotated 90° counterclockwise, which is the same orientation change as 270. 0 means rotation detection ran and the page was already upright; null means rotation detection was disabled for this run (pageRotationEnabled: false) — coordinates need no orientation transform in either case.
originalPageWidth / originalPageHeightThe file’s true page size, independent of rendering resolution — not yet in the same coordinate space as boundingBox/polygon.
dpiThe DPI that boundingBox/polygon coordinates on this page are scaled to. Multiply originalPageWidth/originalPageHeight by dpi / 72 to bring them into that same coordinate space before inverting rotation.

Reusing the same file (by URL or file id) across multiple runs? Later runs will report rotationApplied: 0 — rotation is detected once, when the file first enters Extend’s system, and the processed file is already upright by the time a later run reads it.

output.metadata itself is null for parse runs that completed before this field was introduced.

Every boundingBox and polygon on a page is expressed in the corrected, upright frame — not the orientation of the file you originally uploaded. If you need to draw a citation or highlight on your own copy of the original file, map the returned coordinates back in two steps:

1. Scale the original page dimensions into the returned coordinate space:

W = originalPageWidth * (dpi / 72)
H = originalPageHeight * (dpi / 72)

2. Normalize the angle. rotationApplied can be negative for counterclockwise rotations, so bring it into the 0–359 range before branching on it:

rotation = ((rotationApplied % 360) + 360) % 360

This maps -90 to 270, -180 to 180, and -270 to 90, and leaves non-negative values unchanged. Treat null as 0.

Don’t skip this step. Code that only checks for 90, 180, and 270 will treat -90 as “no rotation” and place every highlight on a counterclockwise-rotated page in the wrong spot.

3. Invert the rotation. Given a returned coordinate (x, y) and the normalized rotation:

rotationoriginal_xoriginal_y
90yH - x
180W - xH - y
270 (including -90)W - yx
0 (including null)xy

Apply the conversion to each corner of a boundingBox or each point of a polygon individually — rotating the box as a whole (for example, swapping width and height) isn’t equivalent.

Example: a page’s originalPageWidth is 100 and originalPageHeight is 200, dpi is 150, and rotationApplied is 90. First scale: W = 100 * (150/72) ≈ 208.3, H = 200 * (150/72) ≈ 416.7. Then a returned corner at (375, 10) maps back to (10, 41.7): original_x = y = 10, original_y = H - x = 416.7 - 375 = 41.7.

function toOriginalCoordinates(x, y, pageMetadata) {
const { rotationApplied, originalPageWidth, originalPageHeight, dpi } = pageMetadata;
const scale = dpi / 72;
const W = originalPageWidth * scale;
const H = originalPageHeight * scale;
// rotationApplied can be negative (counterclockwise), e.g. -90.
// Normalize to 0, 90, 180, or 270 before branching; treat null as 0.
const rotation = (((rotationApplied ?? 0) % 360) + 360) % 360;
switch (rotation) {
case 90:
return { x: y, y: H - x };
case 180:
return { x: W - x, y: H - y };
case 270:
return { x: W - y, y: x };
default:
return { x, y };
}
}