Create Template
curl --request POST \
--url https://api.raydocs.com/extractions/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Invoice Extraction",
"workspace_id": 123,
"description": "<string>",
"schema_json": {
"config": {
"reasoning_enabled": true,
"system_message": "<string>"
},
"definitions": {},
"groups": {}
},
"settings": {
"parsing": {
"contextual_embedding": false
}
}
}
'import requests
url = "https://api.raydocs.com/extractions/templates"
payload = {
"name": "Invoice Extraction",
"workspace_id": 123,
"description": "<string>",
"schema_json": {
"config": {
"reasoning_enabled": True,
"system_message": "<string>"
},
"definitions": {},
"groups": {}
},
"settings": { "parsing": { "contextual_embedding": False } }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Invoice Extraction',
workspace_id: 123,
description: '<string>',
schema_json: {
config: {reasoning_enabled: true, system_message: '<string>'},
definitions: {},
groups: {}
},
settings: {parsing: {contextual_embedding: false}}
})
};
fetch('https://api.raydocs.com/extractions/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.raydocs.com/extractions/templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Invoice Extraction',
'workspace_id' => 123,
'description' => '<string>',
'schema_json' => [
'config' => [
'reasoning_enabled' => true,
'system_message' => '<string>'
],
'definitions' => [
],
'groups' => [
]
],
'settings' => [
'parsing' => [
'contextual_embedding' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.raydocs.com/extractions/templates"
payload := strings.NewReader("{\n \"name\": \"Invoice Extraction\",\n \"workspace_id\": 123,\n \"description\": \"<string>\",\n \"schema_json\": {\n \"config\": {\n \"reasoning_enabled\": true,\n \"system_message\": \"<string>\"\n },\n \"definitions\": {},\n \"groups\": {}\n },\n \"settings\": {\n \"parsing\": {\n \"contextual_embedding\": false\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.raydocs.com/extractions/templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Invoice Extraction\",\n \"workspace_id\": 123,\n \"description\": \"<string>\",\n \"schema_json\": {\n \"config\": {\n \"reasoning_enabled\": true,\n \"system_message\": \"<string>\"\n },\n \"definitions\": {},\n \"groups\": {}\n },\n \"settings\": {\n \"parsing\": {\n \"contextual_embedding\": false\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.raydocs.com/extractions/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Invoice Extraction\",\n \"workspace_id\": 123,\n \"description\": \"<string>\",\n \"schema_json\": {\n \"config\": {\n \"reasoning_enabled\": true,\n \"system_message\": \"<string>\"\n },\n \"definitions\": {},\n \"groups\": {}\n },\n \"settings\": {\n \"parsing\": {\n \"contextual_embedding\": false\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"schema_json": {
"config": {
"reasoning_enabled": true,
"system_message": "<string>"
},
"definitions": {},
"groups": {}
},
"settings": {
"parsing": {
"contextual_embedding": true
}
},
"workspace_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}Extraction Templates
Create Template
Create a new extraction template with a JSON schema.
POST
/
extractions
/
templates
Create Template
curl --request POST \
--url https://api.raydocs.com/extractions/templates \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Invoice Extraction",
"workspace_id": 123,
"description": "<string>",
"schema_json": {
"config": {
"reasoning_enabled": true,
"system_message": "<string>"
},
"definitions": {},
"groups": {}
},
"settings": {
"parsing": {
"contextual_embedding": false
}
}
}
'import requests
url = "https://api.raydocs.com/extractions/templates"
payload = {
"name": "Invoice Extraction",
"workspace_id": 123,
"description": "<string>",
"schema_json": {
"config": {
"reasoning_enabled": True,
"system_message": "<string>"
},
"definitions": {},
"groups": {}
},
"settings": { "parsing": { "contextual_embedding": False } }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Invoice Extraction',
workspace_id: 123,
description: '<string>',
schema_json: {
config: {reasoning_enabled: true, system_message: '<string>'},
definitions: {},
groups: {}
},
settings: {parsing: {contextual_embedding: false}}
})
};
fetch('https://api.raydocs.com/extractions/templates', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.raydocs.com/extractions/templates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Invoice Extraction',
'workspace_id' => 123,
'description' => '<string>',
'schema_json' => [
'config' => [
'reasoning_enabled' => true,
'system_message' => '<string>'
],
'definitions' => [
],
'groups' => [
]
],
'settings' => [
'parsing' => [
'contextual_embedding' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.raydocs.com/extractions/templates"
payload := strings.NewReader("{\n \"name\": \"Invoice Extraction\",\n \"workspace_id\": 123,\n \"description\": \"<string>\",\n \"schema_json\": {\n \"config\": {\n \"reasoning_enabled\": true,\n \"system_message\": \"<string>\"\n },\n \"definitions\": {},\n \"groups\": {}\n },\n \"settings\": {\n \"parsing\": {\n \"contextual_embedding\": false\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.raydocs.com/extractions/templates")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Invoice Extraction\",\n \"workspace_id\": 123,\n \"description\": \"<string>\",\n \"schema_json\": {\n \"config\": {\n \"reasoning_enabled\": true,\n \"system_message\": \"<string>\"\n },\n \"definitions\": {},\n \"groups\": {}\n },\n \"settings\": {\n \"parsing\": {\n \"contextual_embedding\": false\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.raydocs.com/extractions/templates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Invoice Extraction\",\n \"workspace_id\": 123,\n \"description\": \"<string>\",\n \"schema_json\": {\n \"config\": {\n \"reasoning_enabled\": true,\n \"system_message\": \"<string>\"\n },\n \"definitions\": {},\n \"groups\": {}\n },\n \"settings\": {\n \"parsing\": {\n \"contextual_embedding\": false\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"description": "<string>",
"schema_json": {
"config": {
"reasoning_enabled": true,
"system_message": "<string>"
},
"definitions": {},
"groups": {}
},
"settings": {
"parsing": {
"contextual_embedding": true
}
},
"workspace_id": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}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"
}
Authorizations
Body
application/json
⌘I
