Skip to main content
POST
Parse a batch

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

How to parse a document. The same options apply to POST /parse and to every document in POST /parse/batch.

urls
string<uri>[]

Links to documents.

Example:
fileIds
string<uuid>[]

The fileIds of documents you parsed, estimated or uploaded in the last 24 hours.

Example:
mode
enum<string>
default:auto

How pages are read.

  • auto: reads each page's text, and uses AI only on pages that are scans or images.
  • fast: reads text only. Scanned pages come back empty with an error and aren't charged.
  • ocr: reads every page with AI. Slower, and best for scans and handwriting.
Available options:
auto,
fast,
ocr
pages
string

PDF pages to parse, as pages and ranges separated by commas. "10-" means page 10 to the end. Pages past the end are skipped. Other formats ignore this and are parsed whole, with a warning.

Maximum string length: 500
Example:

"1-5,9"

maxPages
integer

Parse at most this many pages, counted from the start of pages (or of the document). PDFs only.

Required range: x >= 1
Example:

3

includePages
boolean
default:false

Adds pages to the result, with each page's Markdown on its own. perPage is accepted as another name for this field. Only applies when the result comes back inline; when polling, use ?pages=true instead.

pageMarkers
boolean
default:false

Puts a <!-- page N --> line before each page in markdown.

prompt
string

What to extract from the document, in plain English, such as "The paper's title and the authors' names". The answer is in json. Costs AI credits on top of the page credits.

Maximum string length: 5000
schema
object

A JSON Schema for the extracted data. The answer is in json and follows this shape. Can be sent with or without a prompt. In a multipart request, send it as a JSON string.

dryRun
boolean
default:false

Returns the page count and the credits the parse would cost, without parsing or charging anything. The document is still stored, so you can parse it next with the returned fileId.

wait
boolean
default:true

Waits up to 20 seconds for the result and returns it inline. Set to false to get a job to poll straight away. POST /parse only; a batch never waits.

Response

dryRun was true. Each document's estimate and the total credits. Nothing was parsed or charged.

status
enum<string>
Available options:
estimate
documents
object[]

One estimate per document, or a failed entry for a document that couldn't be read.

credits
integer

Page credits for the whole batch.