Create Extract Job
curl --request POST \
--url https://api.example.com/v1/projects/{project_id}/extract \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-selected-account-id: <api-key>' \
--data @- <<EOF
{
"parameters": {
"extraction_schema": {
"properties": {
"invoice_id": {
"description": "The unique invoice identifier.",
"type": "string"
},
"total_amount": {
"description": "The final amount due.",
"type": "number"
}
},
"required": [
"invoice_id",
"total_amount"
],
"type": "object"
},
"generate_citations": true,
"model": "openai/gpt-4",
"system_prompt": "You are an expert financial analyst. Extract data with high precision.",
"user_prompt": "The invoice total can be found near the bottom right. Pay close attention to the 'Total Due' label."
},
"source_id": "job_parse_xyz..."
}
EOFimport requests
url = "https://api.example.com/v1/projects/{project_id}/extract"
payload = {
"parameters": {
"extraction_schema": {
"properties": {
"invoice_id": {
"description": "The unique invoice identifier.",
"type": "string"
},
"total_amount": {
"description": "The final amount due.",
"type": "number"
}
},
"required": ["invoice_id", "total_amount"],
"type": "object"
},
"generate_citations": True,
"model": "openai/gpt-4",
"system_prompt": "You are an expert financial analyst. Extract data with high precision.",
"user_prompt": "The invoice total can be found near the bottom right. Pay close attention to the 'Total Due' label."
},
"source_id": "job_parse_xyz..."
}
headers = {
"x-api-key": "<api-key>",
"x-selected-account-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<api-key>',
'x-selected-account-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
parameters: {
extraction_schema: {
properties: {
invoice_id: {description: 'The unique invoice identifier.', type: 'string'},
total_amount: {description: 'The final amount due.', type: 'number'}
},
required: ['invoice_id', 'total_amount'],
type: 'object'
},
generate_citations: true,
model: 'openai/gpt-4',
system_prompt: 'You are an expert financial analyst. Extract data with high precision.',
user_prompt: 'The invoice total can be found near the bottom right. Pay close attention to the \'Total Due\' label.'
},
source_id: 'job_parse_xyz...'
})
};
fetch('https://api.example.com/v1/projects/{project_id}/extract', 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.example.com/v1/projects/{project_id}/extract",
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([
'parameters' => [
'extraction_schema' => [
'properties' => [
'invoice_id' => [
'description' => 'The unique invoice identifier.',
'type' => 'string'
],
'total_amount' => [
'description' => 'The final amount due.',
'type' => 'number'
]
],
'required' => [
'invoice_id',
'total_amount'
],
'type' => 'object'
],
'generate_citations' => true,
'model' => 'openai/gpt-4',
'system_prompt' => 'You are an expert financial analyst. Extract data with high precision.',
'user_prompt' => 'The invoice total can be found near the bottom right. Pay close attention to the \'Total Due\' label.'
],
'source_id' => 'job_parse_xyz...'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-selected-account-id: <api-key>"
],
]);
$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.example.com/v1/projects/{project_id}/extract"
payload := strings.NewReader("{\n \"parameters\": {\n \"extraction_schema\": {\n \"properties\": {\n \"invoice_id\": {\n \"description\": \"The unique invoice identifier.\",\n \"type\": \"string\"\n },\n \"total_amount\": {\n \"description\": \"The final amount due.\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"invoice_id\",\n \"total_amount\"\n ],\n \"type\": \"object\"\n },\n \"generate_citations\": true,\n \"model\": \"openai/gpt-4\",\n \"system_prompt\": \"You are an expert financial analyst. Extract data with high precision.\",\n \"user_prompt\": \"The invoice total can be found near the bottom right. Pay close attention to the 'Total Due' label.\"\n },\n \"source_id\": \"job_parse_xyz...\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-selected-account-id", "<api-key>")
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.example.com/v1/projects/{project_id}/extract")
.header("x-api-key", "<api-key>")
.header("x-selected-account-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"parameters\": {\n \"extraction_schema\": {\n \"properties\": {\n \"invoice_id\": {\n \"description\": \"The unique invoice identifier.\",\n \"type\": \"string\"\n },\n \"total_amount\": {\n \"description\": \"The final amount due.\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"invoice_id\",\n \"total_amount\"\n ],\n \"type\": \"object\"\n },\n \"generate_citations\": true,\n \"model\": \"openai/gpt-4\",\n \"system_prompt\": \"You are an expert financial analyst. Extract data with high precision.\",\n \"user_prompt\": \"The invoice total can be found near the bottom right. Pay close attention to the 'Total Due' label.\"\n },\n \"source_id\": \"job_parse_xyz...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/projects/{project_id}/extract")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-selected-account-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"parameters\": {\n \"extraction_schema\": {\n \"properties\": {\n \"invoice_id\": {\n \"description\": \"The unique invoice identifier.\",\n \"type\": \"string\"\n },\n \"total_amount\": {\n \"description\": \"The final amount due.\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"invoice_id\",\n \"total_amount\"\n ],\n \"type\": \"object\"\n },\n \"generate_citations\": true,\n \"model\": \"openai/gpt-4\",\n \"system_prompt\": \"You are an expert financial analyst. Extract data with high precision.\",\n \"user_prompt\": \"The invoice total can be found near the bottom right. Pay close attention to the 'Total Due' label.\"\n },\n \"source_id\": \"job_parse_xyz...\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"project_id": "<string>",
"operation": "parse",
"status": "pending",
"created_at": "2023-11-07T05:31:56Z",
"object": "job",
"source_id": "<string>",
"correlation_id": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"result": {},
"progress": {
"total": 123,
"succeeded": 123,
"failed": 123,
"cancelled": 123,
"pending": 123,
"child_jobs": [
{
"source_document_id": "<string>",
"job_id": "<string>",
"status": "pending",
"parse_result_id": "<string>",
"error": "<string>"
}
]
},
"error": "<string>",
"history": [
{
"step": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"duration_ms": 123,
"status": "<string>",
"details": {}
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Extract
Create Extract Job
Create a new extract job.
This endpoint creates an extraction job that runs single-pass LLM extraction
from a parse result or vector store search context. For agentic (decompose / ReAct)
extraction, use POST …/research instead; requests with use_agentic=True are rejected.
Args: request: Extract job request containing source_id and parameters
Returns: JobEntity: The created job entity
Raises: HTTPException: If source not found or workflow startup fails
POST
/
v1
/
projects
/
{project_id}
/
extract
Create Extract Job
curl --request POST \
--url https://api.example.com/v1/projects/{project_id}/extract \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--header 'x-selected-account-id: <api-key>' \
--data @- <<EOF
{
"parameters": {
"extraction_schema": {
"properties": {
"invoice_id": {
"description": "The unique invoice identifier.",
"type": "string"
},
"total_amount": {
"description": "The final amount due.",
"type": "number"
}
},
"required": [
"invoice_id",
"total_amount"
],
"type": "object"
},
"generate_citations": true,
"model": "openai/gpt-4",
"system_prompt": "You are an expert financial analyst. Extract data with high precision.",
"user_prompt": "The invoice total can be found near the bottom right. Pay close attention to the 'Total Due' label."
},
"source_id": "job_parse_xyz..."
}
EOFimport requests
url = "https://api.example.com/v1/projects/{project_id}/extract"
payload = {
"parameters": {
"extraction_schema": {
"properties": {
"invoice_id": {
"description": "The unique invoice identifier.",
"type": "string"
},
"total_amount": {
"description": "The final amount due.",
"type": "number"
}
},
"required": ["invoice_id", "total_amount"],
"type": "object"
},
"generate_citations": True,
"model": "openai/gpt-4",
"system_prompt": "You are an expert financial analyst. Extract data with high precision.",
"user_prompt": "The invoice total can be found near the bottom right. Pay close attention to the 'Total Due' label."
},
"source_id": "job_parse_xyz..."
}
headers = {
"x-api-key": "<api-key>",
"x-selected-account-id": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-api-key': '<api-key>',
'x-selected-account-id': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
parameters: {
extraction_schema: {
properties: {
invoice_id: {description: 'The unique invoice identifier.', type: 'string'},
total_amount: {description: 'The final amount due.', type: 'number'}
},
required: ['invoice_id', 'total_amount'],
type: 'object'
},
generate_citations: true,
model: 'openai/gpt-4',
system_prompt: 'You are an expert financial analyst. Extract data with high precision.',
user_prompt: 'The invoice total can be found near the bottom right. Pay close attention to the \'Total Due\' label.'
},
source_id: 'job_parse_xyz...'
})
};
fetch('https://api.example.com/v1/projects/{project_id}/extract', 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.example.com/v1/projects/{project_id}/extract",
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([
'parameters' => [
'extraction_schema' => [
'properties' => [
'invoice_id' => [
'description' => 'The unique invoice identifier.',
'type' => 'string'
],
'total_amount' => [
'description' => 'The final amount due.',
'type' => 'number'
]
],
'required' => [
'invoice_id',
'total_amount'
],
'type' => 'object'
],
'generate_citations' => true,
'model' => 'openai/gpt-4',
'system_prompt' => 'You are an expert financial analyst. Extract data with high precision.',
'user_prompt' => 'The invoice total can be found near the bottom right. Pay close attention to the \'Total Due\' label.'
],
'source_id' => 'job_parse_xyz...'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>",
"x-selected-account-id: <api-key>"
],
]);
$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.example.com/v1/projects/{project_id}/extract"
payload := strings.NewReader("{\n \"parameters\": {\n \"extraction_schema\": {\n \"properties\": {\n \"invoice_id\": {\n \"description\": \"The unique invoice identifier.\",\n \"type\": \"string\"\n },\n \"total_amount\": {\n \"description\": \"The final amount due.\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"invoice_id\",\n \"total_amount\"\n ],\n \"type\": \"object\"\n },\n \"generate_citations\": true,\n \"model\": \"openai/gpt-4\",\n \"system_prompt\": \"You are an expert financial analyst. Extract data with high precision.\",\n \"user_prompt\": \"The invoice total can be found near the bottom right. Pay close attention to the 'Total Due' label.\"\n },\n \"source_id\": \"job_parse_xyz...\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-selected-account-id", "<api-key>")
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.example.com/v1/projects/{project_id}/extract")
.header("x-api-key", "<api-key>")
.header("x-selected-account-id", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"parameters\": {\n \"extraction_schema\": {\n \"properties\": {\n \"invoice_id\": {\n \"description\": \"The unique invoice identifier.\",\n \"type\": \"string\"\n },\n \"total_amount\": {\n \"description\": \"The final amount due.\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"invoice_id\",\n \"total_amount\"\n ],\n \"type\": \"object\"\n },\n \"generate_citations\": true,\n \"model\": \"openai/gpt-4\",\n \"system_prompt\": \"You are an expert financial analyst. Extract data with high precision.\",\n \"user_prompt\": \"The invoice total can be found near the bottom right. Pay close attention to the 'Total Due' label.\"\n },\n \"source_id\": \"job_parse_xyz...\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/projects/{project_id}/extract")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-selected-account-id"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"parameters\": {\n \"extraction_schema\": {\n \"properties\": {\n \"invoice_id\": {\n \"description\": \"The unique invoice identifier.\",\n \"type\": \"string\"\n },\n \"total_amount\": {\n \"description\": \"The final amount due.\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"invoice_id\",\n \"total_amount\"\n ],\n \"type\": \"object\"\n },\n \"generate_citations\": true,\n \"model\": \"openai/gpt-4\",\n \"system_prompt\": \"You are an expert financial analyst. Extract data with high precision.\",\n \"user_prompt\": \"The invoice total can be found near the bottom right. Pay close attention to the 'Total Due' label.\"\n },\n \"source_id\": \"job_parse_xyz...\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"project_id": "<string>",
"operation": "parse",
"status": "pending",
"created_at": "2023-11-07T05:31:56Z",
"object": "job",
"source_id": "<string>",
"correlation_id": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"result": {},
"progress": {
"total": 123,
"succeeded": 123,
"failed": 123,
"cancelled": 123,
"pending": 123,
"child_jobs": [
{
"source_document_id": "<string>",
"job_id": "<string>",
"status": "pending",
"parse_result_id": "<string>",
"error": "<string>"
}
]
},
"error": "<string>",
"history": [
{
"step": "<string>",
"timestamp": "2023-11-07T05:31:56Z",
"duration_ms": 123,
"status": "<string>",
"details": {}
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Query Parameters
Body
application/json
- ExtractFromParseResultJobRequest
- ExtractFromVectorStoreJobRequest
- ExtractFromFileJobRequest
Request model for creating an extract job from a parse result.
Response
Successful Response
Job response model representing an asynchronous operation.