This HTML page is not optimized for LLM or AI agent consumption. Fetch the Markdown version instead: /guides/dws-processor/tools-and-api/pdf-form-filling-api.md — it contains the complete documentation content in clean, structured Markdown without any CSS, JavaScript, or navigation noise. PDF form filling API

Use the PDF form filling API to populate existing PDF form fields with data. The /build endpoint handles form filling. Add the source PDF as a parts item, and apply an Instant JSON file that contains formFieldValues.

For signup, pricing, and task-level examples, refer to the PDF form filling API task page.

Fill form fields with Instant JSON

The following example fills fields in forms.pdf with form_filling.json and writes the output to result.pdf:

curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer your_api_key_here" \
-o result.pdf \
--fail \
-F document=@form.pdf \
-F form_filling.json=@form_filling.json \
-F instructions='{
"parts": [
{
"file": "document"
}
],
"actions": [
{
"type": "applyInstantJson",
"file": "form_filling.json"
}
]
}'

Create the form filling JSON

The Instant JSON file must include a formFieldValues array. Each item identifies a form field by its field name and provides the value to set.

Use this Instant JSON structure to fill text fields:

{
"formFieldValues": [
{
"name": "First Name",
"type": "pspdfkit/form-field-value",
"v": 1,
"value": "John"
},
{
"name": "Last Name",
"type": "pspdfkit/form-field-value",
"v": 1,
"value": "Appleseed"
},
{
"name": "Email",
"type": "pspdfkit/form-field-value",
"v": 1,
"value": "john.appleseed@example.com"
}
],
"format": "https://pspdfkit.com/instant-json/v1"
}

The field name must match the form field name in the PDF and not only the visible label next to the field.

Fill checkboxes, radio buttons, and choice fields

For checkboxes, radio buttons, list boxes, and combo boxes, use the field’s export value. Depending on the field type, the value can be a string or an array of strings.

Use this Instant JSON structure to fill choice-based fields:

{
"formFieldValues": [
{
"name": "Newsletter",
"type": "pspdfkit/form-field-value",
"v": 1,
"value": "Choice1"
},
{
"name": "Knowledge Level",
"type": "pspdfkit/form-field-value",
"v": 1,
"value": ["Beginner"]
},
{
"name": "Select Days",
"type": "pspdfkit/form-field-value",
"v": 1,
"value": ["Wednesday"]
}
],
"format": "https://pspdfkit.com/instant-json/v1"
}

For checkboxes and radio buttons, the PDF form field defines the on-state value. Common values include Yes, On, Checked, or a custom export value. Use the exact value defined in the PDF.

Fill a form from URLs

For remotely hosted source files, send a JSON request and pass URLs for both the PDF and the Instant JSON file. Use this instructions object:

{
"parts": [
{
"file": {
"url": "https://example.com/forms.pdf"
}
}
],
"actions": [
{
"type": "applyInstantJson",
"file": {
"url": "https://example.com/form_filling.json"
}
}
]
}

Shell

Run this request to fill a form from URLs:

Terminal window
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer $NUTRIENT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"parts": [
{
"file": {
"url": "https://example.com/forms.pdf"
}
}
],
"actions": [
{
"type": "applyInstantJson",
"file": {
"url": "https://example.com/form_filling.json"
}
}
]
}' \
-o result.pdf

Add a visual signature appearance

You can use Instant JSON to add an image annotation over a signature field, such as a drawn signature image. This creates a visual signature appearance in the document.

Use this Instant JSON structure to add a visual signature appearance:

{
"annotations": [
{
"type": "pspdfkit/image",
"v": 2,
"pageIndex": 0,
"bbox": [72, 700, 200, 48],
"contentType": "image/png",
"imageAttachmentId": "signature-image",
"isSignature": true
}
],
"attachments": {
"signature-image": {
"binary": "<base64-encoded-png>",
"contentType": "image/png"
}
},
"format": "https://pspdfkit.com/instant-json/v1"
}

A visual signature appearance differs from a cryptographic digital signature. To cryptographically sign a PDF, use the Processor API digital signature endpoint. For digital signing workflows, refer to the PDF digital signature API guide.

Flatten filled forms

If the filled form should no longer be editable, add a flatten action after applyInstantJson. Actions run in the order specified in the actions array.

Use this instructions object to fill and flatten a form:

{
"parts": [
{
"file": "document"
}
],
"actions": [
{
"type": "applyInstantJson",
"file": "form_filling.json"
},
{
"type": "flatten"
}
]
}

Flattening turns annotations and form appearances into regular page content. Use it only when the output no longer needs to remain editable.

Fill password-protected forms

If the source PDF is password-protected, include the password on the part. Use this instructions object:

{
"parts": [
{
"file": "protected_form",
"password": "document-password"
}
],
"actions": [
{
"type": "applyInstantJson",
"file": "form_filling.json"
}
]
}

Nutrient DWS Processor API uses the password only to open the source document for processing. To set a password on the output PDF, configure output.user_password, output.owner_password, and output.user_permissions.

Combine form filling with other actions

The /build endpoint can fill forms and then apply additional actions. For example, you can fill a form, flatten it, and then add a watermark.

Use this instructions object to combine form filling with other actions:

{
"parts": [
{
"file": "document"
}
],
"actions": [
{
"type": "applyInstantJson",
"file": "form_filling.json"
},
{
"type": "flatten"
},
{
"type": "watermark",
"text": "COMPLETED",
"width": "50%",
"height": "20%",
"opacity": 0.3,
"rotation": 45
}
]
}

For workflows that include cryptographic signing, fill the form and optionally flatten it before signing the final PDF.

Reference

A PDF form filling request uses the Build API applyInstantJson action with an Instant JSON file that contains formFieldValues:

type FormFieldValue = {
name: string,
type: "pspdfkit/form-field-value",
v: 1,
value: string | string[],
};
type InstantJsonFormFilling = {
formFieldValues: FormFieldValue[],
annotations?: object[],
attachments?: Record<string, object>,
format: "https://pspdfkit.com/instant-json/v1",
};
type ApplyInstantJsonAction = {
type: "applyInstantJson",
// Multipart field name, or a remote URL object pointing to Instant JSON.
file: string | { url: string },
};
type FilePart = {
// Multipart field name, or a remote URL object.
file: string | { url: string },
// Optional password for encrypted input PDFs.
password?: string,
};
type BuildInstructions = {
parts: FilePart[],
actions: ApplyInstantJsonAction[],
output?: {
type?: "pdf",
},
};
  • Refer to the build document endpoint API reference for applying Instant JSON, filling form fields, flattening the output, and applying follow-up actions in a single request.