Extract
Schema-driven AI extraction for precise structured data.
An Extraction pulls precise fields out of a document. By providing a standard JSON Schema, you instruct the language model to locate, format, and return a matching JSON object, turning unstructured documents into structured records.
Loading diagram…
{
"totalAmount": 450,
"invoiceNumber": "..."
}- Schema Adherence: the output is validated against your JSON Schema.
- Complex Data Extraction: extract nested arrays (like invoice line items) or deep hierarchical objects.
- Contextual Instructions: add instructions to guide the model on specific fields.
🏗️ Configuration
An Extraction is an Operation: it parses the Document, then extracts the fields.
| Parameter | Type | Default | Description |
|---|---|---|---|
outputSchema | object | required | A JSON Schema of the fields to extract. An invalid schema returns 422 invalid_output_schema (Errors). |
tier | string | fast | fast or accurate. See Operation Tiers. |
instructions | string | none | Extra instructions for the model (e.g., "Only extract values in USD"). |
parsing | object | { "tier": "fast" } | How the Document is parsed: tier and pages. See Parse. |
perimeter | string | external | Where your data may go. See Perimeters. |
The model reads the first 20,000 characters of the parsed Document; when it is longer, the Output reports truncated: true.
🛠️ Extract from a Document
For every field and parameter, see the Extractions reference.
Submit an Extraction
curl -X POST "https://api.axelered.com/v1/extractions?wait=30" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@/path/to/invoice.pdf" \
-F 'config={
"outputSchema": {
"type": "object",
"properties": {
"invoiceNumber": { "type": "string" },
"totalAmount": { "type": "number" }
},
"required": ["invoiceNumber", "totalAmount"]
},
"tier": "accurate",
"parsing": { "tier": "accurate" }
}'Once the Extraction is done, the extracted object is in its output:
{
"status": "done",
"output": {
"value": { "invoiceNumber": "INV-0042", "totalAmount": 450 },
"truncated": false
}
}List, Read & Delete
- List Extractions: newest first, optionally for one Document with
?documentId=. Lists leave out theoutput. - Read Extraction: status, credits and
output, with optionalwait. - Delete Extraction: hide an Extraction. Its Document is kept.