Fill a PDF form
edit_pdfFill form fields in a PDF and return the edited file (edit group). Values come from instructions (free-form prose, e.g. "name is Acme Corp; date is 2026-04-15") and/or schema (an edit schema from detect_form_fields with extend_edit:value set per field; extend_edit:image with an image_url for signature images). The document passed here must be the TARGET form, not the source you read values from — parse or extract the source first, then fill. Before authoring a schema fill by hand, call get_documentation with https://docs.extend.ai/editing/configuration.md and follow it. templateId runs a saved edit template instead of file; its stored schema/instructions apply unless overridden below. Output is a pointer { id, presignedUrl } to the filled PDF; the URL expires in ~15 minutes (re-fetch with get_file). Async: a status: "running" result with a runId is not an error — resume with get_edit_run passing that runId, the same workspaceId and environment, and wait: true, repeating until the status is terminal; never re-submit the document. On UNAUTHORIZED or NOT_FOUND, re-call get_me for the granted targets. Output shape is documented at https://docs.extend.ai/editing/response-format.md (get_documentation).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | The PDF form to fill. Exactly one of id/url — e.g. { "url": "https://..." } or { "id": "file_..." }, never a bare string. | |
| schema | No | Populated edit schema (root type: "object", fields carrying extend_edit:* keys). Generate with detect_form_fields. | |
| templateId | No | ID of a saved edit template to use instead of file; instructions/schema/advancedOptions below override the template's values when provided. | |
| environment | Yes | "TEST" = the Test (development) environment, "PRODUCTION" = live. Must match a granted target from get_me (an API key pins one environment). | |
| waitSeconds | No | Max seconds to block waiting on the run (clamped to the server wait budget). | |
| workspaceId | Yes | Target workspace (ws_...). Must be a granted workspace — get_me lists the accepted values. | |
| instructions | No | Prose fill values and/or formatting guidance. | |
| advancedOptions | No | { flattenPdf?, preserveSignatureValidity?, tableParsingEnabled?, radioEnumsEnabled?, nativeFieldsOnly?, conditionalGenerationEnabled? }. preserveSignatureValidity defaults to false. When enabled on signed or append-only PDFs, fills existing compatible fields using extend_edit:source_acroform.fieldName or matching schema field names. Missing text, choice, checkbox, and table fields are skipped. New signatures may still be added where permitted. Defaults flattenPdf to false; flattening signed or append-only PDFs is not supported in this mode. Requires Edit engine 1.0.0-beta or later. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| runId | Yes | ||
| output | No | Pointer to the filled PDF (PROCESSED only); the presignedUrl expires in ~15 minutes. | |
| status | Yes | PROCESSING | PROCESSED | FAILED, or "running" (resume via the get tool). | |
| metrics | No | ||
| runType | No | ||
| failureReason | No | ||
| failureMessage | No |