Skip to main content
Good schemas describe the data that appears in the source document. They should not ask the model to calculate new values, infer unsupported data, or transform results that can be handled downstream.

Use field names that match the document

Field names should be specific and close to the wording in the source document. Specific field names reduce ambiguity and make the output easier to use downstream.

Write precise field descriptions

Descriptions help the extraction model choose the correct value when a document contains similar fields. Include units, date meaning, currency expectations, and business context when they matter.

Use enums for known values

Use enum fields when the output should be one of a known set of values. In the schema JSON used by Extract, enum fields can constrain the output to a predefined set of allowed values.
Enums improve consistency and reduce variation in downstream systems.

Keep schemas simple

Use the simplest structure that matches the data you need. Avoid deep nesting unless the source document actually contains nested information. Deep schemas are harder to maintain and can make extraction less reliable. The examples below show field definitions inside the properties object, not complete top-level schemas. Recommended:
Use a nested object only when grouping fields improves clarity:

Use arrays for repeated data

Use arrays when the document contains repeated values or table rows. The example below shows a field definition inside the properties object, not a complete top-level schema.
Use arrays for:
  • Invoice line items
  • Order lists
  • Product lists
  • Tables with repeated rows
  • Multiple addresses, contacts, or identifiers

Do not ask the schema to calculate new values

The schema should describe values that appear in the source document. Do calculations in your application after extraction. Avoid:
Prefer:
Then calculate downstream:

Use nullable fields

Use nullable field types when a value may not appear in every document.
This makes the schema more permissive when a field may be absent.
In current Extract responses, missing values may still appear as empty strings or empty arrays rather than null, depending on the field and the returned output.

Test with representative documents

Test schemas with documents that reflect real production inputs:
  • Different vendors or document templates
  • Scanned and digital documents
  • Short and long documents
  • Documents with missing fields
  • Documents with tables or repeated rows
Review both extracted values and citations when available.

Iterate on the schema

If extraction quality is poor:
  1. Make field names more specific.
  2. Add clearer descriptions.
  3. Use enums for fixed categories.
  4. Split ambiguous fields into separate fields.
  5. Simplify nested structures.
  6. Test with more representative examples.

Extract Quickstart

Extract your first document.

Schema Guide

Create extraction schemas.

Response Format

Understand the output.