Fill a PDF Form
PDF4me Fill a PDF Form populates AcroForm fields in a PDF template with values from a JSON object in a single REST call. Send the template as Base64 or a public URL, send the field values as a stringified dataArray, and receive the filled PDF as binary bytes (200) or via a Location-header poll URL (202). Toggle KeepPdfEditable to deliver a re-editable form or a flattened static record.
Authenticating Your API Request
Every PDF4me REST call must include your API key in the Authorization header as Basic auth. Get or rotate your key from the developer dashboard.
Endpoint
/api/v2/FillPdfFormhttps://api.pdf4me.com/api/v2/FillPdfFormImportant Facts You Should Not Miss
dataArray is a STRING, not an objectJSON.stringify({...}) before posting. Sending a nested object returns a deserialization error.IsAsync: true the API may respond 202 and a Location header. GET that URL (same Authorization) until it returns 200 with the PDF binary. Standard PDF4me async pattern (pdf4meAsyncRequest).HTTP setup
Method: POST
URL: https://api.pdf4me.com/api/v2/FillPdfForm
Content-Type: application/json
Authorization: Basic <your PDF4me API key>
Send IsAsync: true in the body. 200 returns the filled PDF as binary bytes. 202 returns a Location header with a poll URL; GET that URL with the same Authorization header until it returns 200 with the PDF binary (same convention as pdf4meAsyncRequest).
Variant matrix (Postman-relevant)
Three input variants cover every Postman / curl / SDK call. Pick the variant that matches where your PDF template and form data live.
| Variant | PDF template (templateDocContent) | Form fields | Required API fields |
|---|---|---|---|
| A | Base64 PDF | JSON object → stringify → dataArray | All rows in the JSON-form table below. |
| B | Public PDF URL | JSON object → stringify → dataArray | Same as A; templateDocContent is the URL string. |
| C | Base64 PDF | Base64-encoded JSON file → decode → stringify into dataArray | Same as A; build dataArray from the decoded JSON. |
API body fields
Always sent
| Parameter | Required | What it does | Example |
|---|---|---|---|
| jobIdExt | Optional | Your own reference for this call. It is stored with the API call log so you can correlate calls with your jobs. Type: string. | |
| integrations | Optional | Integration identifiers, forwarded unchanged with the job's notification settings. Type: array. | |
| isAsync | Optional | Set to `true` to process the action asynchronously and get a job to poll at `/api/v2/GetActionStatus`. Only honoured by actions that support asynchronous processing. Type: boolean. | Default true. Toggles the 200 / 202 + Location async pattern. |
| templateDocName | Optional | File name of the PDF form, e.g. `form.pdf`. Defaults to `fillpdfform.pdf`; the extension is always set to `.pdf`. Type: string. | Filename of the template, e.g. template.pdf. Derived from the source URL filename or defaulted to template.pdf. Used for downstream output naming. |
| templateDocContent | Optional | Required. The PDF form to fill. Accepts the base64-encoded file content, a `pdf4meblobid://<id>` reference, or an `https` URL. Type: string. | Base64-encoded PDF (no data: prefix) OR a publicly reachable https URL to the PDF. |
| dataArray | Optional | Form data as a JSON string, e.g. `{"name":"John"}`. Used when `InputFormData` is empty. Type: string. | JSON.stringify({ ... }). Keys = AcroForm field names; values = strings to fill. |
| outputType | Optional | Not used by this endpoint; the value is ignored. Type: string. | Always "pdf". |
| inputDataType | Optional | Not used by this endpoint; the value is ignored. Type: string. | Always "json" for this path. |
| metaData | Optional | Not used by this endpoint; the value is ignored. Type: string. | |
| metaDataJson | Optional | Not used by this endpoint; the value is ignored. Type: string. | |
| InputFormData | Optional | Form field values as a list of name/value pairs. Takes precedence over `dataArray`. Type: array. | |
| keepPdfEditable | Optional | Keep the form fields editable in the filled PDF. Type: boolean. | Default false. Set true to keep AcroForm fields editable in the output PDF; false flattens the form into static text. |
*templateDocName must always be set in the request; pick a sensible filename so output filenames are clean downstream.
Sample payloads
Variant A. PDF Base64 + form JSON
{
"templateDocName": "application-form.pdf",
"templateDocContent": "JVBERi0xLjQKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": false,
"IsAsync": true
}
dataArray must be a string, not a nested JSON object:
"dataArray": "{"firstname":"John","lastname":"Doe"}"
Variant B. PDF URL + form JSON
{
"templateDocName": "application-form.pdf",
"templateDocContent": "https://example.com/forms/application-form.pdf",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": false,
"IsAsync": true
}
Variant C. PDF Base64 + form from base64 JSON
Placeholder in repo: eyJmaXJzdG5hbWUiOiJKb2huIn0= → {"firstname":"John"}.
Equivalent API body after decoding the form JSON:
{
"templateDocName": "application-form.pdf",
"templateDocContent": "JVBERi0xLjQKJcfsj6IKNSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZw...",
"dataArray": "{\"firstname\": \"John\"}",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": false,
"IsAsync": true
}
Optional. keep form editable
{
"templateDocName": "application-form.pdf",
"templateDocContent": "https://example.com/forms/application-form.pdf",
"dataArray": "{\"firstname\": \"John\", \"lastname\": \"Doe\"}",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": true,
"IsAsync": true
}
Postman collection tips
curl example
curl -X POST https://api.pdf4me.com/api/v2/FillPdfForm \
-H "Content-Type: application/json" \
-H "Authorization: Basic YOUR_API_KEY" \
-d '{
"templateDocName": "application-form.pdf",
"templateDocContent": "https://example.com/forms/application-form.pdf",
"dataArray": "{\"firstname\":\"John\",\"lastname\":\"Doe\"}",
"inputDataType": "json",
"outputType": "pdf",
"KeepPdfEditable": false,
"IsAsync": true
}' \
--output filled-form.pdf
Quick reference: required vs optional (Postman)
| Field | A (PDF b64) | B (PDF URL) | C (form b64 → JSON) |
|---|---|---|---|
templateDocName | Required | Required | Required |
templateDocContent | Required (b64) | Required (URL) | Required (b64) |
dataArray | Required | Required | Required (from decoded JSON) |
inputDataType | Required (json) | Required (json) | Required (json) |
outputType | Required (pdf) | Required (pdf) | Required (pdf) |
IsAsync | Required (true) | Required (true) | Required (true) |
KeepPdfEditable | Optional | Optional | Optional |