Authentication & Scope
Requires thetemplates-write ability.
Request
POST /extractions/templates HTTP/1.1
Host: api.raydocs.com
Authorization: Bearer <token>
Content-Type: application/json
{
"name": "Invoice Extraction",
"description": "Extract key fields from invoices",
"workspace_id": 1,
"schema_json": {
"config": {
"reasoning_enabled": true
},
"groups": {
"invoice_details": {
"search_query": "invoice number, date, amount",
"fields": {
"invoice_number": {
"type": "string",
"extraction_prompt": "Extract the invoice number"
},
"total_amount": {
"type": "number",
"extraction_prompt": "Extract the total amount"
}
}
}
}
},
"settings": {
"parsing": {
"contextual_embedding": false
}
}
}
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Template name |
description | string | No | Template description |
workspace_id | integer | Yes | Workspace to create in |
schema_json | object | No | Extraction schema definition |
settings | object | No | Parsing and processing settings |
See the Extraction Schema Guide for detailed schema documentation.
Response
201 Created – The newly created template.
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Invoice Extraction",
"description": "Extract key fields from invoices",
"schema_json": { ... },
"settings": { ... },
"workspace_id": 1,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
