PDF Forms
Endpoints for working with interactive form fields in PDF documents.Fill Form Fields
POST https://api.getdocuforge.dev/v1/pdf/forms/fill
Fill existing form fields in a PDF with provided values.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
pdf | string | Yes | Base64-encoded PDF document |
fields | object[] | Yes | Array of field name/value pairs (see below) |
flatten | boolean | No | If true, flatten form fields after filling (makes them non-editable). Default: false |
output | string | No | "url" (default) or "base64" |
Field Object
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Form field name |
value | string or boolean | Yes | Value to set. Use string for text fields, boolean for checkboxes |
Example
Response
Add Form Fields
POST https://api.getdocuforge.dev/v1/pdf/forms/add-fields
Add new interactive form fields to an existing PDF.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
pdf | string | Yes | Base64-encoded PDF document |
fields | object[] | Yes | Array of field definitions (see below) |
output | string | No | "url" (default) or "base64" |
Field Definition
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Unique field name |
type | string | Yes | "text", "checkbox", or "dropdown" |
page | integer | Yes | Page index (0-based) |
x | number | Yes | X coordinate |
y | number | Yes | Y coordinate |
width | number | No | Field width in points |
height | number | No | Field height in points |
options | string[] | No | Dropdown options (required for "dropdown" type) |
defaultValue | string or boolean | No | Default value for the field |
Example
Response
List Form Fields
POST https://api.getdocuforge.dev/v1/pdf/forms/list-fields
List all form fields in a PDF document.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
pdf | string | Yes | Base64-encoded PDF document |
Example
Response
Errors
All form endpoints return the same error codes:| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid request body or PDF exceeds size limit |
| 401 | UNAUTHORIZED | Invalid or missing API key |
| 429 | RATE_LIMITED | Too many requests |
| 500 | INTERNAL_ERROR | Server error processing form fields |

