Skip to main content
POST
/
document
/
agent
/
jobs
Enqueue an async document agent job
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

Authorization
string
header
required

API key must be provided in the Authorization header

Body

application/json

Request for the v2 document/agent endpoint.

query
string
required

Question to ask about the document(s)

Required string length: 1 - 10000
source_id
string | null

Data source ID of a single indexed document

source_ids
string[] | null

List of data source IDs for multi-document queries (max 50)

Maximum array length: 50
json_schema
Json Schema · object | null

JSON Schema for structured output

model
string
default:claude-opus-4-7

Model to use (claude-opus-4-7, claude-sonnet-4-5-20250929, etc.)

thinking_enabled
boolean
default:true

Enable extended thinking

thinking_budget
integer
default:10000

Token budget for thinking (ignored for adaptive models like Opus 4.7)

Required range: 1000 <= x <= 50000
stream
boolean
default:false

Stream response as SSE events

Response

Successful Response

Returned by POST /document/agent/jobs.

job_id
string
required

Workflow run id — pass to GET/stream/cancel endpoints

status
string
required

Initial status — usually 'queued'

created_at
string
required
message
string
required