pdftojson.dev
API Reference

The API.

One base URL, bearer auth, multipart uploads. Get your key on the dashboard.

Authentication

Every request needs your secret key as a bearer token. Base URL:

https://api.pdftojson.dev
-H "Authorization: Bearer ptj_your_key"

Keys are per-account and carry your monthly page quota. Never ship a key in client-side code — call the API from your server.

POST /v1/extract

Extract the text layer of a digital PDF as JSON, Markdown, or Text. Fast and cheap — no LLM. Scanned PDFs (no text layer) return 422 (OCR is on the roadmap).

Body (multipart/form-data)

FieldTypeDefaultDescription
filefile—The PDF (required, ≤ 20 MB).
formatstringjsonjson · markdown · text · xml
structurestringstructuredJSON shape: structured · paragraphs · words

Example

curl -X POST https://api.pdftojson.dev/v1/extract \ -H "Authorization: Bearer ptj_your_key" \ -F file=@document.pdf \ -F format=json \ -F structure=structured

Response 200

{ "format": "json", "structure": "structured", "pages": 2, "scanned": false, "content": { "pages": [ { "page": 1, "text": "Invoice 2026-0042…" } ] } }

With structure=paragraphs each page carries a paragraphs array; with words, a words array. format=text/markdown return content as a single string.

POST /v1/bank-statement

Structured extraction for bank statements — line-item transactions plus a reconciliation check (opening + credits − debits = closing). Reads scanned statements too. This is the premium path (Developer plan and up).

Body (multipart/form-data)

FieldTypeDefaultDescription
filefile—The statement PDF (required, ≤ 20 MB).

Example

curl -X POST https://api.pdftojson.dev/v1/bank-statement \ -H "Authorization: Bearer ptj_your_key" \ -F file=@statement.pdf

Response 200

{ "account": { "holder": "…", "number": "…" }, "period": { "start": "2026-07-01", "end": "2026-07-31" }, "opening_balance": 1200.00, "closing_balance": 1455.50, "transactions": [ { "date": "2026-07-03", "description": "…", "amount": -40.00 } ], "reconciliation": { "credits": 500.00, "debits": 244.50, "computed_closing": 1455.50, "difference": 0.00, "reconciled": true } }

Formats & structures

formatcontent shape
jsonobject — pages array, shaped by structure
markdownstring — pages joined by ---
textstring — pages joined by blank lines
xmlstring — <document> with one <page> per page
structure (json only)per-page keys
structuredpage, text
paragraphspage, paragraphs[]
wordspage, words[]

Errors

Errors return a JSON body detail with the status below.

StatusMeaning
401Missing or invalid API key.
402Monthly page quota reached — upgrade your plan.
413File larger than 20 MB.
422Not a PDF, bad format/structure, or a scanned PDF sent to /v1/extract.
502Extraction failed (bank-statement model/parse error).

Limits & quota

Usage is metered in pages — each request counts its page count against your monthly quota, which resets each billing period. In-browser conversions on the homepage are free and unlimited; the API is what's metered.

PlanPages / month
Free100 (one-time trial)
Developer1,000
Scale5,000

See pricing. Over quota, both endpoints return 402 before any work runs.