API Documentation
Complete guide to integrate with the AI Agent API
POST
/v1/chatSend a message to the AI agent. Requires API Key authentication. Optionally include a callback_url for async response delivery.
Headers
X-API-KeystringrequiredYour API key from the API Keys pageContent-Typestringrequiredapplication/jsonRequest Body
messagestringrequiredThe user message to sendsession_idstring?Session ID for conversation continuityuser_idstring?Unique user identifierchannelstringChannel identifier (default: "api")brandstring?Brand to use for the responsepersonastring?Persona mode (default: "customer")callback_urlstring?URL to receive async callback with the responsecallback_secretstring?Secret for HMAC-SHA256 signing of callback payloadExample Request
curl -X POST https://your-domain.com/api/v1/chat \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"message": "สวัสดีครับ ขอเช็คยอด",
"user_id": "user-123",
"callback_url": "https://your-server.com/webhook/callback"
}'Example Response
{
"message": "ยอดเครดิตปัจจุบัน 5,000 บาทครับ",
"session_id": "api_user-123",
"trace_id": "abc-123-def-456",
"model_used": "claude-sonnet-4-20250514",
"tools_called": [
{
"tool": "web_r.get_balance",
"success": true,
"latency_ms": 340
}
],
"confidence": 0.95,
"latency_ms": 1234.5,
"handoff": null
}Try It