Edit File
The Edit endpoint allows you to programmatically edit PDF documents by detecting form fields and filling them with provided data. This endpoint is ideal for:
- Automatically filling out PDF forms
- Pre-populating documents with customer data
- Generating filled documents at scale
If you need Extend to detect the form fields and generate a starter schema first, use Generate Edit Schema.
Tutorial and explanation video
Quick Start
Conditional Form Editing
Edit schemas support root-level JSON Schema conditionals, so you can make fields required or optional based on other form values. Supported keywords include dependentRequired, if / then / else, allOf, oneOf, anyOf, and not.
This is useful for forms where follow-up fields only apply to a subset of users. If you do not already have a schema for the form, you can generate one with the Generate Edit Schema API and then refine the conditional logic.
Endpoints
POST /edit_runs
Create an edit run to edit a PDF document. All edit operations are asynchronous - the endpoint returns immediately with an edit run ID that can be used to poll for results.
Request Body
*One of url or id must be provided.
Response
GET /edit_runs/{id}
Retrieve the status and results of an edit run. Poll this endpoint until status is PROCESSED or FAILED.
Path Parameters
Response (Processing)
Response (Completed)
DELETE /edit_runs/{id}
Delete an edit run and all associated data. This operation is permanent and cannot be undone.
Path Parameters
Response
Configuration Options
The config object controls how documents are edited.
Instructions
instructions string
Natural language instructions for the edit operation. Use this to provide context or specific guidance on how to fill the form.
Schema Generation Instructions
schemaGenerationInstructions string
Additional instructions used when Extend needs to generate a schema from the PDF. This is useful when you want to bias field detection or naming without providing a full schema yourself.
Schema
schema object
A JSON Schema defining the structure of fields to edit. The schema uses extend_edit:* properties to specify PDF field types, bounding box positions, text styling options, values to fill, and optional signature image fills.
Schema Types
The type property supports the following formats:
Schema Properties
Each field in the schema can include:
Example Schema
Field values are specified directly on each field using extend_edit:value. This replaces the legacy input object approach.
Signature Image Fills
For signature fields, you can provide an image instead of a text value:
Combed Fields
For fields that require character-by-character input (like SSN, phone numbers, or policy numbers), use combing: true with a maxLength:
Advanced Options
advancedOptions.flattenPdf boolean
When enabled, flattens the PDF after editing, making form fields non-editable. This is useful for generating final documents. Default: false.
advancedOptions.tableParsingEnabled boolean
When enabled, parses table structures in the document. Default: false.
advancedOptions.radioEnumsEnabled boolean
When enabled, imported radio fields are modeled as enums in the schema, ensuring only one of the radio widgets is filled.
advancedOptions.nativeFieldsOnly boolean
When enabled, only native AcroForm fields from the PDF are used in the schema.
Status Values
Error Handling
When an error occurs, the API returns a structured error response:
Error Codes
Examples
Filling a Simple Form with Schema
Async Processing with Polling
Best Practices
-
Implement polling for all operations - All edit runs are async. Poll
GET /edit_runs/{id}until status isPROCESSEDorFAILED. -
Flatten for final documents - Enable
flattenPdf: truewhen generating final documents to prevent further editing. -
Use
extend_edit:valueon each field - Specify values directly on each field in your schema using theextend_edit:valueproperty. -
Use instructions for context - Provide clear instructions when field mapping isn’t straightforward.
-
Handle errors gracefully - Implement retry logic for retryable errors like
OCR_ERRORandINTERNAL_ERROR. -
Enable table parsing for forms with tables - Set
tableParsingEnabled: truefor forms with large regions of empty table cells you want filled. -
Use correct bounding box format - Bounding boxes use
left,top,right,bottomcoordinates (pixel values).

