talonic_save_schema
Save a schema definition to the workspace for reuse. Returns a schema_id that can be passed to talonic_extract.
`talonic_save_schema` persists an extraction template so it can be referenced by ID in future talonic_extract calls. This is useful when the same schema will be applied to many documents — for example, a standard invoice schema used across all vendor invoices, or a contract schema applied to every new agreement.
The recommended workflow is to iterate on the schema inline first (passing it directly to talonic_extract), verify the extraction results with the user, and only call talonic_save_schema once the schema design is confirmed. This avoids cluttering the workspace with draft schemas that never get used.
The response returns both a UUID (id) and a short ID (short_id in SCH-XXXXXXXX format). Either can be used as schema_id in subsequent talonic_extract calls. The version field starts at 1 and increments if the schema is updated through the Talonic dashboard.
| Parameter | Type | Description |
|---|---|---|
| name * | string | Human-readable schema name. |
| definition * | object | Schema definition. Full JSON Schema `{type: "object", properties: {...}}` recommended. |
| description | string | What this schema extracts and when to use it. |
type: "object" and properties. The flat key-type map format is not fully supported server-side yet.Example
{
"name": "Standard Invoice",
"description": "Extracts vendor, line items, totals, and payment terms from invoices.",
"definition": {
"type": "object",
"properties": {
"vendor_name": { "type": "string" },
"invoice_number": { "type": "string" },
"total_amount": { "type": "number" },
"due_date": { "type": "string", "format": "date" },
"line_items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"description": { "type": "string" },
"amount": { "type": "number" }
}
}
}
},
"required": ["vendor_name", "total_amount"]
}
}{
"id": "sch_7a1b2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d",
"short_id": "SCH-A1B2C3D4",
"name": "Standard Invoice",
"description": "Extracts vendor, line items, totals, and payment terms from invoices.",
"version": 1,
"field_count": 5
}Example: iterate inline then save
// Agent extracts with inline schema first:
{
"file_url": "https://example.com/sample-po.pdf",
"schema": {
"type": "object",
"properties": {
"po_number": { "type": "string" },
"vendor": { "type": "string" },
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"description": { "type": "string" },
"quantity": { "type": "integer" },
"unit_price": { "type": "number" }
}
}
},
"total": { "type": "number" },
"delivery_date": { "type": "string", "format": "date" }
},
"required": ["po_number", "vendor", "total"]
}
}
// → User reviews results, confirms the schema looks right// Agent calls talonic_save_schema:
{
"name": "Purchase Order",
"description": "Extracts PO number, vendor, line items, total, and delivery date.",
"definition": {
"type": "object",
"properties": {
"po_number": { "type": "string" },
"vendor": { "type": "string" },
"items": { "type": "array" },
"total": { "type": "number" },
"delivery_date": { "type": "string", "format": "date" }
},
"required": ["po_number", "vendor", "total"]
}
}
// Response:
{
"id": "sch_d4e5f6a7-b8c9-0d1e-2f3a-4b5c6d7e8f9a",
"short_id": "SCH-D4E5F6A7",
"name": "Purchase Order",
"version": 1,
"field_count": 5
}
// → Future extractions use: { "schema_id": "SCH-D4E5F6A7" }The description field is optional but strongly recommended. A clear description helps agents (and users) understand when to use a particular schema. Agents can read schema descriptions from talonic_list_schemas to auto-select the right schema based on the document type. For example, if the user drops a purchase order, the agent can scan saved schema descriptions for keywords like 'purchase order' or 'PO' and suggest the matching schema automatically.
Schema naming conventions matter for discoverability. Use descriptive, consistent names like 'Standard Invoice', 'Certificate of Insurance', or 'Employment Contract' rather than abbreviations or internal codes. These names appear in talonic_list_schemas results and the talonic://schemas resource, where users and agents browse them to find the right template. A well-named schema library reduces friction across the entire team.