Perception

Extract

nace extract https://example.com/invoice.pdf --schema invoice.schema.json -o result
nace extract job:<parse job id> --schema-id sch_... --schema-version 2
FlagWhat it does
-s, --schema SCHEMAThe fields to extract, as a JSON Schema: a file path, @FILE, inline JSON, or -.
--schema-id IDA saved schema (sch_...) instead, at its latest version.
--schema-version NWith --schema-id, use version N.
--instructions TEXTExtra guidance for filling the fields.
--no-citationsDon't say where each field was read: sends citations.enabled: false, keeping the rest of citations.

Pass exactly one of -s and --schema-id, or name the schema as schema or schema_id in --options. A flag replaces any schema the options name. Neither, both flags, both schema and schema_id in the options, or --schema-version without --schema-id exits 2. Drex has no route that only checks a schema, so there is no --validate: a schema the document service refuses fails the create with 422, before any job.

Schemas must use the supported schema keywords. format is converted to descriptive guidance for the extraction model. Match the hint to the field, such as date for an invoice date. Guidance can influence the returned value; validate that value in your application if a strict format is required. For dates, you can also use a string and put the desired representation in description.

invoice.schema.json
{
  "type": "object",
  "properties": {
    "invoice_number": { "type": "string" },
    "total": { "type": "number" }
  },
  "required": ["invoice_number", "total"]
}

Point it at a finished parse to avoid parsing, and paying for, the document twice:

nace parse https://example.com/invoice.pdf -o id
# 6f1a2b3c-...
nace extract job:6f1a2b3c-... --schema invoice.schema.json

See Extract.