跳轉到主要內容

PDF Tools API

Form Filler API

Populate PDF forms from application data, CRMs, onboarding flows, or internal systems and return a ready-to-send PDF.

Credits

1 Credit / call

1 Credit per successful API request. Failed processing attempts are refunded automatically.

Pricing

1,000 Credits = $1

Every signed-in user receives 100 free API Credits each month.

Endpoint

/api/external/pdf-tools/form-filler

Use your API Key in the x-api-key header.

cURL example

curl -X POST https://itextmaster.com/api/external/pdf-tools/form-filler \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: YOUR_API_KEY' \
  -d '{
    "files": [
      { "name": "input.pdf", "dataBase64": "JVBERi0xLjcK..." }
    ],
    "options": {"fields":{"Name":"Ada Lovelace","Approved":true},"flatten":true}
  }' \
  --output filled-form.pdf

Node.js example

import { writeFile } from 'node:fs/promises';

const response = await fetch('https://itextmaster.com/api/external/pdf-tools/form-filler', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': process.env.ITEXTMASTER_API_KEY
  },
  body: JSON.stringify({
  files: [
    { name: 'input.pdf', dataBase64: 'JVBERi0xLjcK...' }
  ],
  options: {"fields":{"Name":"Ada Lovelace","Approved":true},"flatten":true}
})
});

if (!response.ok) {
  throw new Error(await response.text());
}

await writeFile('filled-form.pdf', Buffer.from(await response.arrayBuffer()));

Python example

import os
import requests

response = requests.post(
    'https://itextmaster.com/api/external/pdf-tools/form-filler',
    headers={
        'Content-Type': 'application/json',
        'x-api-key': os.environ['ITEXTMASTER_API_KEY'],
    },
    json={
        'files': [
            {'name': 'input.pdf', 'dataBase64': 'JVBERi0xLjcK...'}
        ],
        'options': {'fields':{'Name':'Ada Lovelace','Approved':true},'flatten':true}
    },
)
response.raise_for_status()

with open('filled-form.pdf', 'wb') as f:
    f.write(response.content)

Error codes

401invalid_api_key

The x-api-key header is missing, invalid, or has been rotated.

402insufficient_credits

The account does not have enough API Credits for the request.

422pdf_tool_processing_failed

The file, options, or PDF structure could not be processed.

Limits

  • Works best with standard fillable PDF form fields.
  • Field names must match the source PDF field names.
  • Flattening makes fields static in the returned PDF.

Example output

filled-form.pdf with X-Credits-Charged: 1 and X-Credit-Balance response headers.

X-Credits-Charged: 1

X-Credit-Balance: 99

Content-Disposition: attachment; filename="filled-form.pdf"

FAQ

Can I flatten filled forms?

Yes. Set flatten to true to convert filled fields into static PDF content.

How do I map data to fields?

Use the fields object with PDF field names as keys and the desired values as values.

Does filling a form use Credits?

Yes. Each successful Form Filler API request uses 1 Credit.

Start with 100 free API Credits

Create an API Key, test Form Filler API, and buy more Credits only when automation volume grows.