Build AI-powered chatbots and receptionists with our comprehensive API
POST /api/conversations
{
"agent_id": 1,
"user_id": null
}
POST /api/chat
{
"conversation_id": 1,
"message": "Hello, I need help scheduling a meeting"
}
{
"message": {
"id": 42,
"role": "assistant",
"content": "I'd be happy to help you schedule a meeting...",
"model": "claude-3-5-sonnet-20241022",
"tokens_input": 45,
"tokens_output": 128,
"latency_ms": 342
},
"conversation": {
"id": 1,
"message_count": 2,
"total_tokens": 173
}
}
Agents are AI assistants with customized personalities, capabilities, and knowledge bases.
| Field | Type | Description |
|---|---|---|
| name | string | Display name of the agent |
| system_prompt | text | Instructions that define agent behavior |
| model | string | AI model to use (claude-3-5-sonnet, gpt-4, etc.) |
| tools | array | List of tools/functions agent can call |
| temperature | decimal | Creativity level (0.0 - 1.0) |
For real-time token streaming, use Server-Sent Events:
GET /api/chat/stream?conversation_id=1&message=Hello
// Response is a stream of SSE events:
data: {"token": "I"}
data: {"token": "'d"}
data: {"token": " be"}
data: {"token": " happy"}
data: {"token": " to"}
data: {"token": " help"}
data: {"token": "..."}
data: [DONE]
Agents can execute functions to integrate with external systems:
{
"name": "schedule_meeting",
"description": "Schedule a meeting with participants",
"parameters": {
"type": "object",
"properties": {
"title": { "type": "string" },
"date": { "type": "string", "format": "date-time" },
"participants": { "type": "array" }
}
}
}
{
"message": {
"role": "assistant",
"content": "I'll schedule that meeting for you.",
"tool_calls": [{
"id": "call_abc123",
"function": "schedule_meeting",
"arguments": {
"title": "Project Review",
"date": "2026-01-25T14:00:00Z",
"participants": ["john@example.com"]
}
}]
}
}
Upload documents to create a knowledge base for your agents:
POST /api/documents
Content-Type: multipart/form-data
file: [PDF/TXT/DOCX file]
agent_id: 1