For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
GuidesAPI ReferenceChangelogModel Versioning
GuidesAPI ReferenceChangelogModel Versioning
    • Getting Started
    • Authentication
    • API Versioning
    • SDKs
    • Deployments
    • Error Codes
    • Async Processing
  • Endpoints
      • POSTEdit File (Sync)
      • POSTEdit File (Async)
      • GETGet Edit Run
      • DELDelete Edit Run
      • GETGet Edit Template
      • POSTGenerate Edit Schema
  • Webhook Events
LogoLogo
EndpointsEdit

Edit File (Async)

POST
/edit_runs
POST
/edit_runs
1import { ExtendClient } from "extend-ai";
2
3const client = new ExtendClient({ token: "YOUR_TOKEN" });
4await client.editRuns.create({
5 file: {
6 url: "https://example.com/form.pdf"
7 },
8 config: {
9 instructions: "Fill out the form with the provided data",
10 advancedOptions: {
11 flattenPdf: true
12 }
13 }
14});
1{
2 "object": "edit_run",
3 "id": "edr_xK9mLPqRtN3vS8wF5hB2cQ",
4 "file": {
5 "object": "file",
6 "id": "file_xK9mLPqRtN3vS8wF5hB2cQ",
7 "name": "Invoices.pdf",
8 "type": "PDF",
9 "parentFileId": "file_Zk9mNP12Qw4yTv8BdR3H",
10 "metadata": {
11 "pageCount": 30,
12 "parentSplit": {
13 "id": "string",
14 "type": "Invoice",
15 "identifier": "other_2_9",
16 "startPage": 1,
17 "endPage": 10
18 }
19 },
20 "createdAt": "2024-03-21T16:45:00Z",
21 "updatedAt": "2024-03-21T16:45:00Z"
22 },
23 "status": "PROCESSING",
24 "failureReason": "FILE_TYPE_NOT_SUPPORTED",
25 "failureMessage": "File type not supported. Edit runs currently require a PDF.",
26 "config": {
27 "schema": {
28 "type": "object",
29 "properties": {},
30 "required": [
31 "string"
32 ],
33 "additionalProperties": true,
34 "dependentRequired": {},
35 "if": {
36 "properties": {},
37 "required": [
38 "string"
39 ],
40 "dependentRequired": {},
41 "allOf": [
42 null
43 ],
44 "oneOf": [
45 null
46 ],
47 "anyOf": [
48 null
49 ]
50 },
51 "then": {
52 "properties": {},
53 "required": [
54 "string"
55 ],
56 "dependentRequired": {},
57 "allOf": [
58 null
59 ],
60 "oneOf": [
61 null
62 ],
63 "anyOf": [
64 null
65 ]
66 },
67 "else": {
68 "properties": {},
69 "required": [
70 "string"
71 ],
72 "dependentRequired": {},
73 "allOf": [
74 null
75 ],
76 "oneOf": [
77 null
78 ],
79 "anyOf": [
80 null
81 ]
82 },
83 "allOf": [
84 {
85 "properties": {},
86 "required": [
87 "string"
88 ],
89 "dependentRequired": {},
90 "allOf": [
91 null
92 ],
93 "oneOf": [
94 null
95 ],
96 "anyOf": [
97 null
98 ]
99 }
100 ],
101 "oneOf": [
102 {
103 "properties": {},
104 "required": [
105 "string"
106 ],
107 "dependentRequired": {},
108 "allOf": [
109 null
110 ],
111 "oneOf": [
112 null
113 ],
114 "anyOf": [
115 null
116 ]
117 }
118 ],
119 "anyOf": [
120 {
121 "properties": {},
122 "required": [
123 "string"
124 ],
125 "dependentRequired": {},
126 "allOf": [
127 null
128 ],
129 "oneOf": [
130 null
131 ],
132 "anyOf": [
133 null
134 ]
135 }
136 ],
137 "not": {
138 "properties": {},
139 "required": [
140 "string"
141 ],
142 "dependentRequired": {},
143 "allOf": [
144 null
145 ],
146 "oneOf": [
147 null
148 ],
149 "anyOf": [
150 null
151 ]
152 }
153 },
154 "instructions": "string",
155 "schemaGenerationInstructions": "string",
156 "advancedOptions": {
157 "tableParsingEnabled": true,
158 "flattenPdf": true,
159 "radioEnumsEnabled": true,
160 "nativeFieldsOnly": true
161 }
162 },
163 "output": {
164 "editedFile": {
165 "id": "file_Ab3cDE45Fg6hIj7KlM8nO",
166 "presignedUrl": "https://extend-ai-files.s3.amazonaws.com/..."
167 },
168 "filledValues": {}
169 },
170 "metrics": {
171 "processingTimeMs": 1234,
172 "pageCount": 5,
173 "fieldCount": 10,
174 "fieldsDetectedCount": 8,
175 "fieldsAnnotatedCount": 10,
176 "fieldDetectionTimeMs": 500,
177 "fieldAnnotationTimeMs": 200,
178 "fieldFillingTimeMs": 300
179 },
180 "usage": {
181 "credits": 9,
182 "totalCredits": 15,
183 "breakdown": [
184 {
185 "object": "parse_run",
186 "id": "pr_3UZSj69pYZDKHFuuX57ic",
187 "credits": 6
188 }
189 ]
190 }
191}
Edit and manipulate PDF documents by detecting and filling form fields. The Edit Runs endpoint allows you to convert and edit documents and get an edit run ID that can be used to check status and retrieve results with the [Get Edit Run](https://docs.extend.ai/2026-02-09/developers/api-reference/endpoints/edit/get-edit-run) endpoint. For more details, see the [Edit File guide](https://docs.extend.ai/2026-02-09/product/editing/edit). See [Async Processing](https://docs.extend.ai/2026-02-09/developers/async-processing) for a full guide on polling helpers and webhooks. ## Polling with the SDK The SDK provides a `createAndPoll` / `create_and_poll` method that handles polling automatically, returning when the run reaches a terminal state (`PROCESSED` or `FAILED`): <Tabs> <Tab title="TypeScript"> ```typescript const result = await client.editRuns.createAndPoll({ file: { url: "https://..." }, config: { /* edit config */ } }); // Returns when the run reaches a terminal state console.log(result.output); ``` </Tab> <Tab title="Python"> ```python result = client.edit_runs.create_and_poll( file={"url": "https://..."}, config={ ... } # edit config ) # Returns when the run reaches a terminal state print(result.output) ``` </Tab> <Tab title="Java"> ```java var result = client.editRuns().createAndPoll(EditRunCreateRequest.builder() .file(FileInput.builder().url("https://...").build()) .config(EditConfig.builder().build()) .build()); // Returns when the run reaches a terminal state System.out.println(result.getOutput()); ``` </Tab> </Tabs>
Was this page helpful?
Previous

Get Edit Run

Next
Built with

Edit and manipulate PDF documents by detecting and filling form fields.

The Edit Runs endpoint allows you to convert and edit documents and get an edit run ID that can be used to check status and retrieve results with the Get Edit Run endpoint.

For more details, see the Edit File guide. See Async Processing for a full guide on polling helpers and webhooks.

Polling with the SDK

The SDK provides a createAndPoll / create_and_poll method that handles polling automatically, returning when the run reaches a terminal state (PROCESSED or FAILED):

TypeScript
Python
Java
1const result = await client.editRuns.createAndPoll({
2 file: { url: "https://..." },
3 config: { /* edit config */ }
4});
5// Returns when the run reaches a terminal state
6console.log(result.output);

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Headers

x-extend-api-version"2026-02-09"Optional
API version to use for the request. If you're using an SDK, you can ignore this parameter. If you are not using an SDK and do not specify a version, you will either receive a `400 Bad Request` or be set to a previous legacy version. See [API Versioning](https://docs.extend.ai/2026-02-09/developers/api-versioning) for more details.

Request

This endpoint expects an object.
fileobjectRequired
The file to be edited. Files can be provided as a URL or an Extend file ID.
configobjectOptional
Configuration options for the editing process.

Response

Successfully initiated edit run
objectenum

The type of object. Will always be "edit_run".

Allowed values:
idstring

A unique identifier for the edit run.

Example: "edr_xK9mLPqRtN3vS8wF5hB2cQ"

fileobject
The input file that was submitted for editing.
statusenum

The status of the edit run:

  • "PROCESSING" - The file is still being processed
  • "PROCESSED" - The file was successfully edited
  • "FAILED" - The editing failed (see failureReason for details)
Allowed values:
failureReasonstring or null

The reason for failure.

Availability: Present when status is "FAILED".

Possible values include:

  • UNABLE_TO_DOWNLOAD_FILE - Failed to load the requested file
  • FILE_TYPE_NOT_SUPPORTED - File type not supported. Edit runs currently require a PDF
  • FILE_SIZE_TOO_LARGE - The file exceeds the maximum allowed size
  • CORRUPT_FILE - The file appears to be corrupted and cannot be edited
  • FIELD_DETECTION_ERROR - An error occurred during field detection
  • PASSWORD_PROTECTED_FILE - The file is password protected and cannot be edited
  • FAILED_TO_CONVERT_TO_PDF - The file could not be converted to PDF for processing
  • INTERNAL_ERROR - An unexpected internal error occurred
  • INVALID_OPTIONS - The provided configuration options are invalid
  • EMPTY_SCHEMA - No schema was provided and no fields could be detected
  • OUT_OF_CREDITS - Insufficient credits to process the file

Note: Additional failure reasons may be added in the future. Your integration should handle unknown values gracefully.

failureMessagestring or null

A human-readable description of the failure.

Availability: Present when status is "FAILED".

configobject
The configuration used for this edit run, including any default values that were applied.
outputobject or null

The output of the edit run.

Availability: Present when status is "PROCESSED".

metricsobject or null

Metrics about the editing process.

Availability: Present when status is "PROCESSED".

usageobject or null

Usage credits consumed by this edit run.

Availability: Present when status is "PROCESSED", the run was created after October 7, 2025, and the customer is on the current billing system.

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
404
Not Found Error
422
Unprocessable Entity Error
429
Too Many Requests Error
500
Internal Server Error

API version to use for the request. If you’re using an SDK, you can ignore this parameter. If you are not using an SDK and do not specify a version, you will either receive a 400 Bad Request or be set to a previous legacy version. See API Versioning for more details.