Fill PDF forms from JSON by API: fields, types, flatten

Fill fillable PDF forms from JSON: list the fields for free, send values by field name, let the API check each value, and flatten if the result must not change.

A JSON object fills the text fields and checkbox of a PDF form

Government forms, onboarding packs, insurance claims: many still have to be submitted as a specific PDF. If the PDF is fillable, the PDF Form Fill API fills it from your data in two steps.

Step 1: read the fields, free

curl https://api.justapi.tech/v1/pdf/form-fields \
  -H "Authorization: Bearer ak_live_..." \
  -H "Content-Type: application/json" \
  -d '{"source": {"url": "https://files.example.com/application.pdf"}}'

You get every field the form has:

"fields": [
  { "name": "full_name", "type": "text", "value": null, "required": true, "read_only": false, "pages": [1] },
  { "name": "agree", "type": "checkbox", "value": "Off", "options": ["Yes"], "pages": [2] },
  { "name": "state", "type": "choice", "value": null, "options": ["CA", "NY", "TX"], "editable": false, "pages": [1] }
]

This call is free. Run it once per form template and keep the field names in your code or your no-code tool.

Step 2: fill

curl https://api.justapi.tech/v1/pdf/form-fill \
  -H "Authorization: Bearer ak_live_..." \
  -H "Content-Type: application/json" \
  -d '{"source": {"url": "https://files.example.com/application.pdf"}, "options": {"fields": {"full_name": "Ana López", "agree": true, "state": "TX"}, "flatten": true}}'

Values by type

Field Send
text a string or a number
checkbox true or false
radio one of its options
choice (dropdown or list) one of its options; any text if it is editable

The API checks every value before it writes anything. An unknown field name, a string for a checkbox, a value not in a dropdown, or text longer than a field's limit fails with invalid_request and says which field. Nothing is charged.

Appearances

A form field has a value and an appearance, the picture viewers draw. Some tools set only the value, and the field looks empty in Chrome or on a phone until someone clicks it. The API draws the appearance for each value it writes, so the filled form looks right everywhere.

Flatten

flatten: true turns the filled fields into ordinary page content. The result looks the same but cannot be edited, which is what you want before archiving or submitting. Leave it off if the recipient must still edit or sign.

What is stored

Form values often contain personal data. They are used to fill the file and are not stored: the job record keeps only a hash of them. The filled PDF is kept for up to 24 hours for download, or deleted at once when you acknowledge it.

Not supported

Scanned forms with no fields, and XFA forms (an old Adobe format, mostly in some government PDFs) cannot be filled. The fields call tells you: it returns an empty list.

Cost

Reading fields is free. Filling costs $0.006 per call at the first tier. Try it with the free PDF form filler.