Fill PDF form fields by API, one document or thousands
Name the fields and their values; the API writes them, reads them back to confirm, and optionally flattens the form so the values become part of the page. The text endpoint lists every field name and current value first, so you never guess. For many documents, the batch endpoint takes one template and a list of records and returns one finished PDF per record.
How it works
List the fields
POST /v1/text returns the form fields with names, types and current values alongside the page text.
Fill
One form edit with a fields map: strings, numbers, booleans for checkboxes; flatten: true burns the values in.
Batch
POST /v1/batch with records (or a records_url CSV) runs the same edits once per row; a job id returns one output per record when done.
The request
{"source": {"file_id": "f_…"},
"edits": [{"op": "form", "fields": {"name": "Jane Roe", "date": "2026-03-14", "agree": true}, "flatten": true}]}
Or as one curl with a local file, getting the PDF straight back:
curl -sS https://api.niubai.vip/v1/edit -F file=@form.pdf \
-F 'edits=[{"op": "form", "fields": {"name": "Jane Roe", "agree": true}}]' -H "Accept: application/pdf" -o form.filled.pdf
Real output


From an AI agent
Install once (claude mcp add pdfedit -- npx -y @niubai/pdfedit-mcp, or the buttons on the Cursor and VS Code pages; no Node: npx skills add zp130221/pdfedit-mcp), then say it in plain words:
Use ./offer-template.pdf and ./hires.csv: one PDF per row, filling {name} and {salary} from the columns.
Questions
How do I find the field names?
POST /v1/text with the forms layer returns every AcroForm field with its name, type and current value. The MCP server's pdf_find does the same.
Checkboxes and radio buttons?
Booleans set checkboxes; radio groups take the option's export value. Where a file's appearance stream cannot be flattened, the field is left live and flatten_skipped is warned rather than failing.
Can I fill a template for a whole spreadsheet?
Yes: POST /v1/batch with the template and records (inline or a CSV URL); placeholders like {name} in ordinary text are replaced per record as well, not only form fields.
Is the filled form verified?
Every value is read back from the output document; a value that did not land is reported in failed[] with a reason.
Also: Replace text in a PDF by API · PDF redaction API that removes the text for real. Full reference: API reference · GitHub.