PDF form filler API
Fill a PDF form from JSON — and get JSON back
Upload the PDF you were handed. You get a typed JSON schema of its fields and one endpoint that returns the finished document. Publish the same form to your users and the values they enter arrive on your webhook as JSON. No Acrobat, no headless browser, no account to try it.
1. Your PDF becomes a JSON schema
Upload a fillable PDF and every AcroForm field is read out with its type, its length limit and whether it is required. That schema is the contract your code writes against.
{
"fields": [
{ "name": "full_name", "type": "text", "required": true, "maxLength": 60 },
{ "name": "date_of_birth", "type": "date", "required": true },
{ "name": "consent", "type": "checkbox", "required": false },
{ "name": "signature", "type": "signature" }
]
}Handed a flat PDF — a scan, or an export with no form layer? Draw named boxes over the page instead and you get the same schema. That is the common case: of the forms people actually receive, most have no AcroForm at all.
2. POST your values, get the document
One request. The response carries the completed PDF.
curl -X POST https://www.doc2api.co/api/v1/templates/<TEMPLATE_ID>/fill \
-H "X-Api-Key: d2a_live_…" \
-H "Content-Type: application/json" \
-d '{
"data": {
"full_name": "Ada Lovelace",
"date_of_birth": "1815-12-10",
"consent": true
},
"flatten": true
}'Values are checked against the schema, so a misspelled field name is an error you get back rather than a blank line on a document somebody signs. Text that will not fit is reported. A date can be printed in whatever pattern the form wants — dd/MM/yyyy, or ddMMyyyy for the boxed-per-character kind — while the value you sent and the value stored stay ISO.
3. Or let your users fill it, and take the JSON
This is the half people usually mean when they search for getting data out of a filled PDF. Embed the real form on your own site. Someone completes it — typing, ticking, drawing a signature, attaching a photo — and two things arrive: the finished PDF, and the values as JSON.
{
"event": "submission.created",
"template_id": "…",
"data": {
"full_name": "Ada Lovelace",
"date_of_birth": "1815-12-10",
"consent": true,
"signature": "https://your-storage.example.com/sig/1a2b.png"
},
"pdf_url": "https://…/deliveries/…/completed.pdf"
}You never parse the PDF for its data, because the data reached you before the PDF existed. That matters more than it sounds: a completed PDF is usually flattened, and a flattened PDF has no fields left to read — the values are ink on a page. Capturing them at the point of entry is the only way to get them reliably, and it is free.
The delivery is signed so you can prove it came from us, retried if your endpoint is briefly down, and the same values are available from the submissions endpoint and as a CSV export.
What makes filling a form different from generating one
Most “PDF API” tools build a document out of your HTML. That is a different job. When a regulator, a council or an insurer hands you their form, you cannot redraw it — the layout is the point, and the boxes have to be filled where they are.
- AcroForm fields filled in place, with the form kept editable or flattened as you choose.
- Flat and scanned forms handled by drawing named boxes on the page — no form layer needed.
- Comb fields: per-character letter spacing, so a reference number lands one digit per printed cell.
- Per-side padding, for when a printed rule sits low in its box.
- Checkboxes, radio groups, drawn signatures, photographs and rich text.
- Unicode built in — Arabic and Hebrew are shaped and reordered, not dropped.
What this does not do
Said here rather than discovered later. If you have an already-filled PDF from somebody else and want its values as JSON, this is not the tool. Reading values back only works while the file is a live AcroForm, and completed forms are almost always flattened — the text is drawn onto the page and the fields are gone. Pulling data out of those needs OCR, which is a different product with different accuracy promises, and we would rather say so than sell you a request that returns an empty object.
If the form is yours to publish, section 3 is the answer: collect the values as they are typed and the extraction problem never arises.
Drop a PDF on the homepage and see the schema
No signup. You get the real editor, a working API key and documents back — the whole thing, before you decide anything.
Related: what people generate, Zapier, Make and n8n, and how we compare.