Product / REST API

API Reference

Complete reference of endpoints, webhooks, and integrations scripts to automate your workspace flows programmatically.

Authentication

Authenticate your requests using Bearer API keys. Add the key in the Authorization header of your HTTP requests. Keep your secret key secure.

GET/v1/auth/verify
Requestbash
curl -H "Authorization: Bearer tc_live_key" \
  https://api.trained.chat/v1/auth/verify
Responsejson
{
  "status": "authenticated",
  "organization": "Acme Corp",
  "scope": ["read", "write"]
}

Chat API

Send messages to a deployed agent. The API returns the response along with the exact source citation records utilized to synthesize the answers.

POST/v1/chat/message
Requestbash
curl -X POST \
  -H "Authorization: Bearer tc_live_key" \
  -H "Content-Type: application/json" \
  -d '{
    "agentId": "agent_941a",
    "message": "Where is my order #124?"
  }' \
  https://api.trained.chat/v1/chat/message
Responsejson
{
  "agentId": "agent_941a",
  "response": "Your order has shipped.",
  "citations": [
    {
      "source": "shipping-policy.pdf",
      "pages": [12]
    }
  ]
}

Search API

Query your knowledge core directly. Returns the raw parsed text chunks ranked by cosine similarity relevance scores.

POST/v1/knowledge/search
Requestbash
curl -X POST \
  -H "Authorization: Bearer tc_live_key" \
  -d '{
    "query": "refund limits"
  }' \
  https://api.trained.chat/v1/knowledge/search
Responsejson
{
  "query": "refund limits",
  "results": [
    {
      "chunk": "Refunds are limited...",
      "score": 0.941
    }
  ]
}

Agents API

Create, configure, and retrieve agent instances programmatically. Update system prompts and assigned tool schemas.

GET/v1/agents
Requestbash
curl -H "Authorization: Bearer tc_live_key" \
  https://api.trained.chat/v1/agents
Responsejson
{
  "agents": [
    {
      "id": "agent_941a",
      "role": "Support",
      "status": "deployed"
    }
  ]
}

Webhooks

Subscribe to real-time events. Get notified when agents take actions, require human handoff, or encounter errors.

POST/v1/webhooks/subscribe
Requestbash
curl -X POST \
  -H "Authorization: Bearer tc_live_key" \
  -d '{
    "url": "https://yourserver.com/callback",
    "events": ["agent.action", "agent.handoff"]
  }' \
  https://api.trained.chat/v1/webhooks/subscribe
Responsejson
{
  "id": "webhook_sub_412",
  "status": "active"
}