/parse

Parse a file into a structured Markdown and/or JSON. Files must be less than 300MB and 2000 pages. We use LibreOffice to convert DOC(X) and PPT(X) files to PDF, which may affect page count.

See our blog post and code examples. Email parse-feedback@contextual.ai with any feedback or questions.

post/parse

Request

  • Base URL
    https://api.contextual.ai/v1
  • URL
    https://api.contextual.ai/v1/parse
  • Auth
    HTTP bearer

Request body multipart/form-data

raw_filestring binary required

The file to be parsed. The file type must be PDF, DOC / DOCX, PPT / PPTX, PNG, JPG / JPEG.

parse_mode'basic' | 'standard'
enable_document_hierarchyboolean

Adds a table of contents to the output with the structure of the entire parsed document. This feature is in beta. Controls parsing heading levels (e.g. H1, H2, H3) at higher quality. Not permitted in basic parsing_mode, or if page_range is not continuous and/or does not start from page zero.

enable_split_tablesboolean

Controls whether tables are split into multiple tables by row with the headers propagated. Use for improving LLM comprehension of very large tables. Not permitted in basic parsing_mode.

max_split_table_cellsinteger

Threshold number of table cells beyond which large tables are split if enable_split_tables is True. Must be null if enable_split_tables is False.

page_rangestring

Optional string representing page range to be parsed. Format: comma-separated indexes (0-based, e.g. 0,1,2,5,6), or ranges inclusive of both ends (e.g. 0-2,5,6)

Example request

{
  "enable_document_hierarchy": true
}

Response

Successful Response

job_idstring uuid required

Unique ID of the parse job

Changes