Skip to content
Docs Security Sign in
PdfParse

Document parsing API reference

This reference covers every endpoint of the PdfParse REST API, the options each one accepts, the objects it returns and the errors you can expect. The Python and Node SDKs wrap the same contract.

Authentication

Authentication and base URL

All requests go to the base URL below over HTTPS. Authenticate with the API key from your dashboard in a bearer header. Keys are secret, so call the API from your server, never from a browser or mobile app.

curl
BASE_URL=https://api.pdfparse.ai/v1
curl "$BASE_URL/usage" -H "Authorization: Bearer pp_live_your_key"

Starter includes 1 API key, Growth 5, Scale 20, and Enterprise has unlimited keys with limits per key. A request without a valid key returns 401.

Endpoints

Method Path Purpose
POST /v1/parse Parse one file, returned synchronously for small files or as a job for larger ones
GET /v1/jobs/{id} Read the status and result of a parse job
DELETE /v1/jobs/{id} Delete a job with its file and outputs (pages already parsed still count as usage)
POST /v1/schemas Create an extraction schema
GET /v1/schemas List the schemas on your account
POST /v1/batches Submit up to 500 files as one batch job
GET /v1/batches/{id} Read the status of a batch and its jobs
GET /v1/usage Read pages used in the current billing period

Parse a document

Send the file as multipart form data in a field named file, or send a JSON body with a url the API can download. Accepted formats are PDF, scanned PDF, PNG, JPG and TIFF, including multi page files.

curl
curl https://api.pdfparse.ai/v1/parse \
  -H "Authorization: Bearer pp_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://files.example.com/invoice.pdf",
    "outputs": ["json", "markdown", "csv"],
    "ocr": "auto",
    "pages": "1-5",
    "schema_id": "sch_supplier_invoice",
    "chunking": {"strategy": "section", "max_tokens": 800}
  }'

Small files return 200 with the complete result. Larger files return 202 with the job id and a status, and the result is read from GET /v1/jobs/{id} or delivered by webhook.

Request options

Option Type Default Description
file binary none The document, sent as multipart form data
url string none Link to the document, used instead of file
outputs array ["json"] Any of "json", "markdown" and "csv"
ocr string "auto" "auto" runs OCR on pages without a text layer, "always" on every page, "off" never
pages string all pages Page range such as "1-5", only these pages are parsed and counted
schema_id string none Id of a saved schema, Growth and above
schema object none Inline schema for a single request, Growth and above
chunking object none For example {"strategy":"section","max_tokens":800}, Growth and above

Response object

Field Description
id Job id, also used by GET /v1/jobs/{id}
status queued, processing, completed or failed
pages One entry per page with number, width, height and blocks
pages[].blocks Each block has type, text, bbox and confidence
blocks[].type heading, paragraph, table, list, form_field, checkbox or image
blocks[].bbox Coordinates [x0, y0, x1, y1] on the page
markdown The whole document as Markdown, when requested
tables One entry per table with page, csv, rows and columns
fields Schema fields, each with value, confidence and source page
chunks Section chunks with text, page_start, page_end, section_path and bbox
usage.pages Pages counted against your allowance by this job
JSON
{
  "id": "job_8f2c41",
  "status": "completed",
  "pages": [
    {"number": 1, "width": 612, "height": 792,
     "blocks": [{"type": "heading", "text": "Invoice", "bbox": [72, 64, 210, 92], "confidence": 0.98}]}
  ],
  "markdown": "# Invoice\n...",
  "tables": [{"page": 1, "csv": "Item,Qty,Amount\n...", "rows": 6, "columns": 3}],
  "fields": {"total": {"value": "1240.00", "currency": "USD", "confidence": 0.95, "page": 1}},
  "chunks": [{"text": "...", "page_start": 1, "page_end": 1, "section_path": ["Invoice", "Line items"], "bbox": [72, 300, 540, 520]}],
  "usage": {"pages": 1}
}

Schemas

POST /v1/schemas takes a name and a list of fields. Each field has a name, a type and a description that tells the engine what to look for. The accepted types are string, number, date, money, boolean and array. GET /v1/schemas lists what you have saved. Growth stores up to 10 schemas, Scale and Enterprise have no limit.

Batches and usage

POST /v1/batches accepts up to 500 files per job on Growth and above, with the same options as a single parse. GET /v1/batches/{id} reports overall progress and the id of every job inside the batch. GET /v1/usage returns pages used, the allowance and the dates of the current billing period, and on Scale and Enterprise a breakdown per API key. Pages count as usage in the billing period, and deleting a document never returns them.

Error codes

Errors return a JSON body with a code, a readable message and the HTTP status.

Status Code Meaning
400 bad_request Malformed body or an invalid option value
401 unauthorized Missing or invalid API key
402 page_limit_reached Monthly allowance used, parsing paused until you upgrade, nothing is charged automatically
404 not_found Unknown job, batch or schema id
413 file_too_large File exceeds the size or page count your plan allows per file
415 unsupported_media_type Format other than PDF, PNG, JPG or TIFF
422 unprocessable The file could not be read, for example a password protected or corrupted PDF
429 rate_limit Too many requests for your account, retry after the interval in the Retry-After header
500 server_error Unexpected error on our side, safe to retry with the same Idempotency-Key

Page and file limits per plan

Plan Pages per month Max file size Max pages per file
Starter 2,000 25 MB 100
Growth 7,000 50 MB 300
Scale 24,000 100 MB 1,000
Enterprise 72,000 200 MB 2,000

Jobs wait in the queue when your account submits more than it can run at once, and the API returns 429 when that queue is full. Scale and Enterprise use a priority queue. Prices for each plan are on PDF extraction API pricing.

Webhooks and signature verification

On Growth and above you can register an HTTPS endpoint in the dashboard. PdfParse sends two events, parse.completed and parse.failed, each as a JSON body with a type and a data object that holds the job. Every delivery carries the PdfParse-Signature header, the hex encoded HMAC SHA256 of the raw body computed with your endpoint secret. Compute the same value on your side over the raw bytes and compare in constant time before trusting the payload. Deliveries that do not receive a 2xx answer are retried with backoff, so handlers should tolerate the same event twice.

Python
import hmac, hashlib

def is_valid(raw_body: bytes, signature: str, secret: str) -> bool:
    expected = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature)

Idempotency

Add an Idempotency-Key header with a unique value to POST /v1/parse and POST /v1/batches. If a timeout makes you send the same request again with the same key, the API returns the original job instead of creating a second one, so pages are never counted twice for one intended request.

Versioning

The version is part of the path, /v1. Within a version we only add things, such as new optional request options, new response fields or new block types, so clients should ignore fields they do not know. A change that would break existing code is released under a new path, and /v1 keeps working alongside it.

Client libraries

The Python PDF parser and the PDF parse npm package cover every endpoint in this reference with typed results, polling and retries. The processing stages behind each call are described on the PDF extraction API page, and the module list by plan is on the data extraction tool page.

Get your API key

Every plan includes the REST API, both SDKs and the web app.