Tork Chat API

Chat API Reference

Complete reference for the Tork Chat REST API. Send messages, stream responses, ingest documents, and manage conversations.

Overview

Base URL

https://chat.tork.network

Authentication

X-Tork-Key header

Content-Type

application/json
bash
curl -X POST https://chat.tork.network/chat \
  -H "X-Tork-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello!", "tenant_id": "your-tenant", "session_id": "session-1"}'

Endpoints

POST/chat

Send a message and get an AI response. The message is routed through the multi-agent system and passes through the governance pipeline before returning.

Request Body

json
{
  "message": "What vehicles do you have?",
  "tenant_id": "acme",
  "session_id": "sess_abc123"
}

Response

json
{
  "response": "We have 12 vehicle groups including the VW Polo Vivo...",
  "conversation_id": "conv_7f3a2b1c",
  "governance": {
    "receipt_id": "rcpt_hmac_9x8y7z",
    "pii_detected": false
  }
}
POST/chat/stream

Stream a response via Server-Sent Events (SSE). Returns token-by-token delivery for real-time UI rendering.

Request Body

json
{
  "message": "What is your insurance policy?",
  "tenant_id": "acme",
  "session_id": "sess_abc123"
}

Response (SSE Stream)

text
event: typing
data: {"status": "processing"}

event: token
data: {"token": "We"}

event: token
data: {"token": " offer"}

event: governance
data: {"receipt_id": "rcpt_hmac_4a5b6c", "pii_detected": false}

event: done
data: {"conversation_id": "conv_7f3a2b1c"}
POST/ingest

Upload a document to the knowledge base. Supports PDF, DOCX, and TXT files. Documents are chunked and embedded for RAG retrieval.

Request

bash
curl -X POST https://chat.tork.network/ingest \
  -H "X-Tork-Key: your-api-key" \
  -F "file=@pricing-guide.pdf" \
  -F "tenant_id=acme"

Response

json
{
  "chunks": 47,
  "document_id": "doc_8k2m4n6p"
}
GET/health

Health check endpoint. Returns service status. No authentication required.

Response

json
{
  "status": "ok"
}

Rate Limits

Free100 messages/month
Starter1,000 messages/month
Growth5,000 messages/month
Business25,000 messages/month
EnterpriseUnlimited