Skip to main content
POST
/
document
/
agent
Query document(s) with an AI agent
curl --request POST \
  --url https://apigcp.trynia.ai/v2/document/agent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "<string>",
  "source_id": "<string>",
  "source_ids": [
    "<string>"
  ],
  "json_schema": {},
  "model": "claude-opus-4-6-1m",
  "thinking_enabled": true,
  "thinking_budget": 10000,
  "stream": false
}
'
{
  "answer": "<string>",
  "model": "<string>",
  "citations": [
    {
      "content": "<string>",
      "tool_source": "<string>",
      "page_number": 123,
      "section_id": "<string>",
      "section_title": "<string>",
      "section_path": [
        "<string>"
      ],
      "source_id": "<string>",
      "source_name": "<string>"
    }
  ],
  "structured_output": {},
  "usage": {}
}

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 10)

Maximum array length: 10
json_schema
Json Schema · object

JSON Schema for structured output

model
string
default:claude-opus-4-6-1m

Model to use (claude-opus-4-6-1m, claude-opus-4-6, 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.6)

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

Stream response as SSE events

Response

Successful Response

Response from the v2 document/agent endpoint.

answer
string
required
model
string
required
citations
DocumentCitation · object[]
structured_output
Structured Output · object
usage
Usage · object