Detect Form
Detect Form detects the fields in a PDF form and returns a form_detection_run whose output.schema you can pass straight to /edit or /edit_runs. The returned schema has field positions annotated, so you don’t have to write extend_edit:bbox coordinates by hand. Optionally, supply your own schema and Extend maps it onto the detected fields. Set advancedOptions.conditionalGenerationEnabled to true to also generate JSON Schema validation rules from requirements stated in the form.
Reach for it when you:
- Need a starter schema for a new PDF form.
- Want to map an existing schema onto a vendor-specific layout.
- Need annotated field locations before running edits at scale.
- Want Extend to generate conditional form validation rules from the form’s content.
Use POST /detect_form for synchronous testing. For production workloads, use POST /form_detection_runs and poll GET /form_detection_runs/{id} to avoid request timeout issues.
Quick start
We’ll detect the fields in a PDF form. Grab a key from the Developers page and store it as the EXTEND_API_KEY environment variable. If you’re using an SDK, see the installation instructions.
Python
TypeScript
Java
Go
cURL
Response
The response is a form_detection_run. A successful synchronous request returns after the run reaches PROCESSED; the asynchronous endpoint usually returns it with status: "PROCESSING".
Asynchronous processing
For production workloads, create a form detection run and poll it by ID:
Poll until status is PROCESSED or FAILED. See Async Processing for retry and polling guidance.
Request configuration
The config object is shared by the sync and async form detection endpoints:
Generate conditional validation rules
When advancedOptions.conditionalGenerationEnabled is true, Extend reads the form content together with the detected field schema and adds validation rules that the form explicitly asks for. For example, a form that says “If Yes, provide an explanation” can produce an if / then rule that requires the explanation field only when the answer is true.
Generated rules are added to output.schema using supported root-level JSON Schema keywords: dependentRequired, if / then / else, allOf, oneOf, anyOf, and not. Extend only generates rules for fields present in the detected schema; it does not infer requirements from layout, proximity, or general knowledge about the form.
To learn how these keywords work, see Conditional schema validation in the JSON Schema documentation.
These conditionals act as validation rules for the form data. When you pass the generated schema to /edit or /edit_runs, Extend checks generated field values against the rules and can retry generated values that do not satisfy them. If the values still fail validation, the Edit run fails with SCHEMA_VALIDATION_ERROR—in the HTTP error body’s code for /edit, or in the run’s failureReason for /edit_runs. They do not add interactive UI behavior such as showing or hiding fields in a browser.
Conditional generation is model-based. Review the generated rules before using the schema in production, especially for high-stakes forms.
A common workflow
The generated schema uses the same format as edit runs, including support for root-level JSON Schema conditionals. A common workflow is:
- Generate a schema from the PDF form with
conditionalGenerationEnabled: true. - Review and, if needed, refine the generated validation rules.
- Use the schema with
/editor/edit_runs.
For the exact request and response schemas, see Detect Form (Sync), Detect Form (Async), and Get Form Detection Run.

