Skip to main content
Parse File
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

object
required
A file object containing either a URL or base64 encoded content. Must contain either fileUrl or fileId.
object
required
Configuration options for the parsing process.

Response

string
The type of object. Will always be “parser_run”.
string
A unique identifier for the parser run.
string
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.
array
An array of chunks extracted from the document.
string
The status of the parser run. Possible values:
  • PROCESSED: The file was successfully processed
  • FAILED: The processing failed (see failureReason for details)
string
The reason for failure if status is “FAILED”. Will be null for successful runs.
object
The configuration used for the parsing process, including any default values that were applied.
object
Metrics about the parsing process.

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:
  1. 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.
  2. 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:
string
A specific error code that identifies the type of error.
string
A human-readable description of the error.
string
A unique identifier for the request, useful for troubleshooting.
boolean
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 nor fileBase64 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: