Parse File
Parse files to get cleaned, chunked target content (e.g. markdown).
The Parse endpoint allows you to convert documents into structured, machine-readable formats with fine-grained control over the parsing process. This endpoint is ideal for extracting cleaned document content to be used as context for downstream processing, e.g. RAG pipelines, custom ingestion pipelines, embeddings classification, etc.
Unlike processor and workflow runs, parsing is a synchronous endpoint and returns the parsed content in the response. Expected latency depends primarily on file size. This makes it suitable for workflows where you need immediate access to document content without waiting for asynchronous processing.
For a deeper guide on how to use the output of this endpoint, jump to Using Parsed Output.
Body
A file object containing either a URL or base64 encoded content. Must contain either fileUrl or fileId.
properties
The name of the file. If not set, the file name is taken from the url or generated in case of raw upload.
A URL for the file. For production use cases, we recommend using presigned URLs with a 5-15 minute expiration time.
If you already have an Extend file id (for instance from running a workflow or a previous file upload) then you can use that file id when running the parse endpoint so that it leverage any cached data that might be available.
Configuration options for the parsing process.
properties
The target format for the parsed content. Supported values:
markdown
: Convert document to Markdown formatspatial
: Preserve spatial information in the output
Strategy for dividing the document into chunks.
properties
The type of chunking strategy. Supported values:
page
: Chunk document by pages.document
: Entire document is a single chunk. Essentially no chunking.section
: Split by logical sections. Not support for target=spatial.
Specify a minimum number of characters per chunk.
Specify a maximum number of characters per chunk.
Options for controlling how different block types are processed.
properties
Options for figure blocks.
properties
Whether to include figures in the output.
Whether to clip and extract images from figures.
Options for table blocks.
properties
Whether to include tables in the output.
The target format for the table blocks. Supported values:
markdown
: Convert table to Markdown formathtml
: Convert table to HTML format
Options for text blocks.
properties
Whether an additional vision model will be utilized for advanced signature detection. Recommended, for most use cases, but should be disabled if signature detection is not necessary and latency is a concern.
Advanced parsing options.
properties
Whether to automatically detect and correct page rotation.
Response
The type of object. Will always be “parser_run”.
A unique identifier for the parser run.
The identifier of the file that was parsed. This can be used as a parameter to other Extend endpoints, such as processor runs. This allows downstream processing to reuse a cache of the parsed file content to reduce your usage costs.
An array of chunks extracted from the document.
properties
The type of object. Will be “chunk”.
The type of chunk (e.g., “page”).
The textual content of the chunk in the specified target format.
Metadata about the chunk.
properties
The page range this chunk covers. Often will just be a partial page, in which cases start
and end
will be the same.
properties
The starting page number (inclusive).
The ending page number (inclusive).
An array of block objects that make up the chunk. See the Block object documentation for more detailed information about block structure and types.
properties
The type of object. Will be “block”.
A unique identifier for the block.
The type of block. Possible values include:
text
: Regular text contentheading
: Section or document headingssection_heading
: Subsection headingstable
: Tabular data with rows and columnsfigure
: Images, charts, or diagrams
The textual content of the block.
Additional details specific to the block type.
Metadata about the block.
properties
Information about the page this block appears on.
properties
The page number.
The width of the page in inches.
The height of the page in inches.
An array of points defining the polygon that bounds the block.
A simplified bounding box for the block.
The status of the parser run. Possible values:
PROCESSED
: The file was successfully processedFAILED
: The processing failed (see failureReason for details)
The reason for failure if status is “FAILED”. Will be null for successful runs.
The configuration used for the parsing process, including any default values that were applied.
Metrics about the parsing process.
properties
The time taken to process the document in milliseconds.
The number of pages in the document.
Using Parsed Output
The Parse API returns document content in a structured format that provides both high-level formatted content and detailed block-level information. Understanding how to work with this output will help you get the most value from the parsing service.
Working with Chunks
Each chunk (currently only page-level chunks are supported) contains two key properties:
-
content
: A fully formatted representation of the entire chunk in the target format (e.g., markdown). This is ready to use as-is if you need the complete formatted content of a page. -
blocks
: An array of individual content blocks that make up the chunk, each with its own formatting, position information, and metadata.
When to use chunk.content
vs. chunk.blocks
-
Use
chunk.content
when:- You need the complete, properly formatted content of a page, already doing the logical placement of blocks (e.g. grouping markdown sections and placing spatially, etc)
- You want to display or process the document content as a whole (and can just combine all chunk.content values)
- You’re integrating with systems that expect formatted text (e.g., markdown processors)
-
Use
chunk.blocks
when:- You need to work with specific elements of the document (e.g., only tables or figures)
- You need spatial information about where content appears on the page, perhaps to build citation systems
- You’re building a UI that shows or highlights specific document elements
Example: Extracting specific content types
Example: Reconstructing content with custom formatting
Spatial Information
Each block contains spatial information in the form of a polygon
(precise outline) and a simplified boundingBox
. This information can be used to:
- Highlight specific content in a document viewer
- Create visual overlays on top of the original document
- Understand the reading order and layout of the document
By leveraging both the formatted content and the structured block information, you can build powerful document processing workflows that combine the convenience of formatted text with the precision of block-level access.
Error Response Format
When an error occurs, the API returns a structured error response with the following fields:
A specific error code that identifies the type of error.
A human-readable description of the error.
A unique identifier for the request, useful for troubleshooting.
Indicates whether retrying the request might succeed.
Custom Error Codes
The API may return the following specific error codes:
Custom Error Codes
We provide custom error codes to make it easier for your system to know what happened in case of a failure. There will also be a retryable=true|false
field in the response body, but you can also find a breakdown below. Most errors are not retryable and are client errors related to the file provided for parsing.
HTTP error codes
Corresponding http error codes for different types of failures. We generally recommend relying on our custom error codes for programmatic handling.
Returned when:
- Required fields are missing (e.g.,
file
) - Neither
fileUrl
norfileBase64
is provided in the file object - The provided
fileUrl
is invalid - The provided
fileBase64
is invalid - The
config
contains invalid values (e.g., unsupported target format or chunking strategy) - The file type is not supported
- The file size is too large
Returned when:
- The API token is missing
- The API token is invalid
Returned when:
- The authenticated workspace doesn’t have permission to use the parse functionality
- The API token doesn’t have sufficient permissions
Returned when:
- The file is corrupt and cannot be parsed
- The file is password protected
- The file could not be converted to PDF
- The system failed to generate the target format
Returned when:
- An OCR error occurs
- A chunking error occurs
- Any other unexpected error occurs during parsing
Handling Errors
Here are examples of how to handle errors from the Parse API: