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
Tutorial and explanation video
Quick Start
Endpoints
POST /edit
Edit a PDF document synchronously. The request will wait for the edit operation to complete (up to 5 minutes) before returning results.
Request Body
*One of fileUrl or fileId must be provided.
Response
POST /edit/async
Edit a PDF document asynchronously. Returns immediately with an edit run ID that can be used to poll for results.
This is useful for:
- Large files that may take longer to process
- Avoiding timeout issues with synchronous editing
- Processing multiple files in parallel
Request Body
Same as POST /edit.
Response
GET /edit_runs/{id}
Retrieve the status and results of an edit run.
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
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, and values to fill.
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.
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
When enabled, automatically detects form fields in the document. Default: true.
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.
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
-
Use async for large files - For files larger than a few MB or complex forms, use the async endpoint to avoid timeouts.
-
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).

