Overview
An extraction schema is a JSON object that defines which fields to extract from a document and how to structure the output. You pass the schema to the ADE Extract API along with Markdown content generated by the ADE Parse API. Use this article as a reference for understanding how schemas are structured and how the API handles unsupported keywords.Basic Structure
The extraction schema must follow this structure:x-alternativeNames keyword to account for field name variations across documents:
Top-Level Type Requirement
The top-leveltype keyword must be "object". Schemas with a different top-level type will return an error.
In the following example, the highlighted line shows the required top-level type keyword:
Define Each Field
Each field you want to extract is defined as a property inside theproperties keyword. Each property can include the following:
Field Names
Required. The field name is the key that identifies each property in theproperties object and determines how the extracted value is labeled in the output.
Field names can contain letters, numbers, underscores, and hyphens. Use descriptive, specific names that clearly indicate what data to extract:
invoice_numberinstead ofnumberpatient_nameinstead ofname
Supported Field Types
Required. Use thetype keyword to define the data type of the extracted value. Supported types are:
In the following example, the highlighted line shows the
type keyword:
To restrict a field to a specific set of allowed values, use the
enum keyword.Restrict Values with Enum
Optional. Use theenum keyword to restrict the extracted value to a specific set of allowed values. String values are recommended; include "type": "string" when using string values. If the enum list holds numbers, include "type": "number" or "type": "integer" as appropriate. extract-20260819 and extract-20260903 return the matching number (for example, 30, not "30"). Other snapshots convert non-string values to strings.
For example, the following schema restricts the extracted account type to one of three allowed values. The highlighted lines show the type and enum keywords:
In the Playground, “enum” appears as a field type option in the Type drop-down menu. When you export the schema, the Playground outputs this correctly using the
enum keyword.Field Descriptions
Optional. Use thedescription keyword to help the API identify and extract the correct data. The more specific your descriptions, the more accurate the extraction.
Include the following in your descriptions:
- Exactly what data to extract
- What to include or exclude (for example, “excluding tax” or “including area code”)
description keyword:
Format
Optional. Use theformat keyword to specify how the extracted value should be formatted. This is most commonly applied to string fields.
The format keyword accepts natural-language instructions and standard JSON Schema format values. Natural-language instructions offer more flexibility, since you can describe formatting requirements that don’t have a standard equivalent. We recommend experimenting with different values to find what works best for your use case.
The following examples illustrate the range of options:
In the following example, the highlighted line shows the
format keyword:
Alternative Names
Optional. Use thex-alternativeNames keyword to list alternative labels for a field. This helps the API locate the correct data when documents use different labels for the same field, such as “Invoice Number” versus “Reference Number.”
In the following example, the highlighted lines show the x-alternativeNames keyword:
Properties (For Objects)
Required forobject types. Use the properties keyword to define the fields within a nested object. For a full example, see Nested Objects.
Format Arrays with items
Required for array types. Use the items keyword to define the structure of items in an array. For a full example, see Arrays.
Nested Objects
Use nested objects when the data you want to extract has a natural hierarchical structure. For example, an invoice might include a billing address with multiple sub-fields (street, city, state, and ZIP code), or a patient form might have separate sections for personal details and insurance information. In the following example, the highlighted lines show a nestedproperties keyword inside the invoice object:
Arrays
Use arrays to extract repeating structures from a document, such as all rows in a table. Each item in the array follows the same schema, making arrays well-suited for data like transaction lists, invoice line items, or lists of charges. To define an array field:- Set
"type": "array"on the field. - Include the
itemskeyword to define the structure of each item. - Inside
items, define the fields each item should contain.
Keyword Support
The ADE Extract API only supports a specific set of JSON Schema keywords. Unsupported keywords are removed before extraction runs; they do not cause errors.Supported Keywords
The ADE Extract API supports the following keywords. For details on each, see Define Each Field.descriptionenum(string values recommended)formatitemspropertiestypex-alternativeNamesadditionalProperties(boolean values only)
Ignored Keywords
The following keywords are not supported but will not cause errors. The API removes or resolves them before running extraction.Other Unsupported Keywords
Any keyword not listed in Supported Keywords or Ignored Keywords is removed during schema conversion, and extraction continues with the remaining schema. The following list provides common examples and is not exhaustive:allOfconstmaxItemsmaxLengthmaximumminItemsminLengthminimumoneOfpatternpropertyOrderinguniqueItems
How the API Handles Required Fields
The ADE Extract API treats all fields as required and always attempts to extract every property defined in your schema. Therequired keyword is not supported and is ignored if included. For more information, see Ignored Keywords.
If the API cannot find a field in the document, it returns an empty value, usually null, rather than an error. For more information, see How the API Handles Missing Fields.
How the API Handles Missing Fields
When the API cannot find a field in the document, it returns an empty value rather than an error. For example, if your schema includes afirst_name field but the document does not contain a first name, the API returns null for that field.
On extract-20260903, the default snapshot, a number, integer, boolean, or enum field returns null only when your schema allows null for that field. If the schema doesn’t allow it, the model returns a value of the field’s type instead, such as -1, false, or one of the enum options. To allow null, see Return Null for Number, Integer, Boolean, and Enum Fields.
The exact behavior depends on the field type:
Return Null for Number, Integer, Boolean, and Enum Fields
Onextract-20260903, a number, integer, boolean, or enum field returns null when the document has no value for it, as long as your schema allows null for the field. An enum field is any field with an enum list, including a string field. The rule also applies to fields inside arrays. It doesn’t change string fields without an enum, arrays, or objects. On other snapshots, the API removes null from the field’s type in the schema before extraction.
The API checks the output against your schema, so every keyword that limits the field’s values must allow null. For example, if null is in the enum list but the field has "type": "string", the field returns null, but a synchronous request returns HTTP 206 with schema_violation_error set. See Status 206: Partial Success.
Any of these forms allows null without a 206:
- The
nullable: truekeyword, on anynumber,integer,boolean, or enum field. - A
typelist that includes"null", such as"type": ["number", "null"]. On an enum field, also addnullto theenumlist. - An
anyOfwith a{"type": "null"}branch. - An
enumlist that includesnull, on a field with notypekeyword.
discount_amount and payment_method return null when the invoice shows no discount or payment method. The highlighted lines allow null:
Schema Validation
The API processes your schema in two stages:Validate Schema Structure (Before Extraction)
The API checks that your schema is valid JSON and follows the required structure. If validation fails, the API returns a422 error before processing begins. Common causes are a schema that is not valid JSON, a root that is not "type": "object", a $ref that is not a local #... reference, or recursive $ref cycles.
Convert Schema (During Processing)
The API converts your schema before running extraction. Keywords that are not supported are removed during this step (see Ignored Keywords and Other Unsupported Keywords), and extraction continues with the remaining schema.FAQs for Extraction Schemas
Does the order of properties in the schema need to match the order of the fields in the document?
No. The order of properties in the schema has no impact on extraction. For example, a property defined last in the schema can still extract data from a field that appears at the top of the document.Is there a maximum number of fields that can be extracted?
No. There is no maximum number of properties in an extraction schema.Can I put formatting and alternative names in the description field?
You can include formatting instructions and alternative field names indescription, but using the dedicated format and x-alternativeNames keywords is more effective.
When you use dedicated keywords, the API knows exactly what each piece of information is: format contains only formatting instructions, and x-alternativeNames contains only alternative field labels. This allows the API to apply each more precisely than if the same information were embedded in a general description.
For more information, see Format and Alternative Names.