v4 extract model. See Model Versions for how to select it.
How Extract uses your schema
Your schema does two jobs at once:- Output shape. Extract constrains the response so it always has the fields and types you declared.
- Guidance. Field names, descriptions, and constraints tell Extract what to look for and how to format it.
"pattern": "^[A-Z]{2}-\\d{4}$" on a string guarantees the output matches. "format": "email" does not guarantee a valid address, but it does steer Extract toward one.
Enforced keywords
The output satisfies these keywords, with the exceptions noted in each row.Every field is always returned
Extract returns every declared field on every object, even if you list only some of them inrequired. Scalar fields (string, number, integer, boolean, enum) with no supporting value in the document come back as null. Object and array fields keep their declared shape: an array with no matches is [], and an object has all of its own fields set to null. If a field must not be null in your system, check for it in your code.
Best-effort keywords
Extract reads these keywords as guidance. Output usually follows them, but it is not guaranteed. Validate these in your code if they matter.Prefer pattern over format
format improves how Extract writes a value, but only pattern guarantees the shape.
Ignored keywords
These keywords are accepted but have no effect on extraction:default, $comment, $schema, deprecated, readOnly, writeOnly.
Schema validation
Extract validates your schema before it runs. Invalid schemas fail with a400 and a message that points at the problem. Common causes:
- The schema is not valid JSON Schema (draft 2020-12).
- An object declares no
properties. - An array declares no
items. $refpoints outside#/$defs, or forms a cycle.- A
requiredentry names a field that is not inpropertieson a closed object. - An
enumorconstvalue does not match the declaredtypeor violates a sibling constraint, such as"enum": ["ab"]with"minLength": 3.
Troubleshooting
A value comes backnull even though it is in the document.
Extract works from the Parse output, so your Parse configuration affects extraction accuracy. Use Parse r-1 or agentic modes for the best results. If the value is still missing, tighten the field description to say where the value appears.
A string does not match my format.
format is best effort. Add a pattern for the exact shape.
An extra field I did not declare is missing.
Extract only returns declared fields. Declare the field in properties.
My allOf constraint is not respected.
allOf is best effort. Combine the branches into one object schema with the union of their properties and constraints.