curl --request POST \
--url https://apigcp.trynia.ai/v2/document/agent/jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"source_id": "<string>",
"source_ids": [
"<string>"
],
"json_schema": {},
"model": "claude-opus-4-7",
"thinking_enabled": true,
"thinking_budget": 10000,
"stream": false
}
'import requests
url = "https://apigcp.trynia.ai/v2/document/agent/jobs"
payload = {
"query": "<string>",
"source_id": "<string>",
"source_ids": ["<string>"],
"json_schema": {},
"model": "claude-opus-4-7",
"thinking_enabled": True,
"thinking_budget": 10000,
"stream": 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({
query: '<string>',
source_id: '<string>',
source_ids: ['<string>'],
json_schema: {},
model: 'claude-opus-4-7',
thinking_enabled: true,
thinking_budget: 10000,
stream: false
})
};
fetch('https://apigcp.trynia.ai/v2/document/agent/jobs', 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://apigcp.trynia.ai/v2/document/agent/jobs",
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([
'query' => '<string>',
'source_id' => '<string>',
'source_ids' => [
'<string>'
],
'json_schema' => [
],
'model' => 'claude-opus-4-7',
'thinking_enabled' => true,
'thinking_budget' => 10000,
'stream' => 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://apigcp.trynia.ai/v2/document/agent/jobs"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"source_id\": \"<string>\",\n \"source_ids\": [\n \"<string>\"\n ],\n \"json_schema\": {},\n \"model\": \"claude-opus-4-7\",\n \"thinking_enabled\": true,\n \"thinking_budget\": 10000,\n \"stream\": false\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://apigcp.trynia.ai/v2/document/agent/jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"source_id\": \"<string>\",\n \"source_ids\": [\n \"<string>\"\n ],\n \"json_schema\": {},\n \"model\": \"claude-opus-4-7\",\n \"thinking_enabled\": true,\n \"thinking_budget\": 10000,\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigcp.trynia.ai/v2/document/agent/jobs")
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 \"query\": \"<string>\",\n \"source_id\": \"<string>\",\n \"source_ids\": [\n \"<string>\"\n ],\n \"json_schema\": {},\n \"model\": \"claude-opus-4-7\",\n \"thinking_enabled\": true,\n \"thinking_budget\": 10000,\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"status": "<string>",
"created_at": "<string>",
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Enqueue an async document agent job
Create a long-running document agent job. Returns immediately with a job_id — use GET /document/agent/jobs/ to poll for the result or GET /document/agent/jobs//stream for live SSE updates.
Recommended for production workloads, batch evaluation pipelines, or anything that may run longer than ~10 minutes. The job runs on a background worker pool with 30-minute hard timeout, per-user concurrency caps, and automatic refunds on failure.
curl --request POST \
--url https://apigcp.trynia.ai/v2/document/agent/jobs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"source_id": "<string>",
"source_ids": [
"<string>"
],
"json_schema": {},
"model": "claude-opus-4-7",
"thinking_enabled": true,
"thinking_budget": 10000,
"stream": false
}
'import requests
url = "https://apigcp.trynia.ai/v2/document/agent/jobs"
payload = {
"query": "<string>",
"source_id": "<string>",
"source_ids": ["<string>"],
"json_schema": {},
"model": "claude-opus-4-7",
"thinking_enabled": True,
"thinking_budget": 10000,
"stream": 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({
query: '<string>',
source_id: '<string>',
source_ids: ['<string>'],
json_schema: {},
model: 'claude-opus-4-7',
thinking_enabled: true,
thinking_budget: 10000,
stream: false
})
};
fetch('https://apigcp.trynia.ai/v2/document/agent/jobs', 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://apigcp.trynia.ai/v2/document/agent/jobs",
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([
'query' => '<string>',
'source_id' => '<string>',
'source_ids' => [
'<string>'
],
'json_schema' => [
],
'model' => 'claude-opus-4-7',
'thinking_enabled' => true,
'thinking_budget' => 10000,
'stream' => 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://apigcp.trynia.ai/v2/document/agent/jobs"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"source_id\": \"<string>\",\n \"source_ids\": [\n \"<string>\"\n ],\n \"json_schema\": {},\n \"model\": \"claude-opus-4-7\",\n \"thinking_enabled\": true,\n \"thinking_budget\": 10000,\n \"stream\": false\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://apigcp.trynia.ai/v2/document/agent/jobs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"source_id\": \"<string>\",\n \"source_ids\": [\n \"<string>\"\n ],\n \"json_schema\": {},\n \"model\": \"claude-opus-4-7\",\n \"thinking_enabled\": true,\n \"thinking_budget\": 10000,\n \"stream\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apigcp.trynia.ai/v2/document/agent/jobs")
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 \"query\": \"<string>\",\n \"source_id\": \"<string>\",\n \"source_ids\": [\n \"<string>\"\n ],\n \"json_schema\": {},\n \"model\": \"claude-opus-4-7\",\n \"thinking_enabled\": true,\n \"thinking_budget\": 10000,\n \"stream\": false\n}"
response = http.request(request)
puts response.read_body{
"job_id": "<string>",
"status": "<string>",
"created_at": "<string>",
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
API key must be provided in the Authorization header
Body
Request for the v2 document/agent endpoint.
Question to ask about the document(s)
1 - 10000Data source ID of a single indexed document
List of data source IDs for multi-document queries (max 50)
50JSON Schema for structured output
Model to use (claude-opus-4-7, claude-sonnet-4-5-20250929, etc.)
Enable extended thinking
Token budget for thinking (ignored for adaptive models like Opus 4.7)
1000 <= x <= 50000Stream response as SSE events
Was this page helpful?

