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.
Top-level fields
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.
Inline (default)
URL (responseType=url)
The content is embedded directly in the response body.
How to use it: read output.chunks directly.
The response carries a download link instead of inline content.
How to use it: fetch the JSON at outputUrl. It has the same shape as output (a top-level chunks array).
outputUrl expires 15 minutes after the response is returned. Download or process the content promptly.
Handle both shapes by checking which field is populated:
Python
TypeScript
Java
Go
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.
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
undeterminedCoveragerather 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.
Python
TypeScript
Java
Go
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.
content vs. blocks
Each chunk gives you two views of the same content. Pick based on what you’re building:
- Use
chunk.contentwhen you want ready-to-use formatted text: feeding an LLM, building a RAG index, or displaying a page. Concatenate every chunk’scontentto reconstruct the whole document. - Use
chunk.blockswhen you need structure or position: pulling out only tables or figures, building citations and highlights, or rendering overlays on the original document.
Python
TypeScript
Java
Go
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.
Block fields
Block types
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.
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.
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:
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:
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:
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 & Co the middle node has content: "&" and a byteLength of 5.
Constraints
advancedOptions.htmlSourceAnchorscannot be combined withadvancedOptions.alwaysConvertToPdf.advancedOptions.returnSourceNodesrequiresadvancedOptions.htmlSourceAnchors.- Both are rejected at request validation with an HTTP 400
INVALID_REQUESTerror. An unsupported encoding fails the run withUNSUPPORTED_FILE_ENCODING: an HTTP 400 on/parse, orstatus: "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:
These reflect OCR confidence (how reliably the characters were recognized). Both are null when word-level confidence is unavailable.
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.
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:
Python
TypeScript
Java
Go
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:
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:
2. Normalize the angle. rotationApplied can be negative for counterclockwise rotations, so bring it into the 0–359 range before branching on it:
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:
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.

