API Reference
Complete list of Tavio API endpoints. All endpoints require authentication unless noted otherwise. Base URL: https://bankmind.aihookd.site
Chat
| Method | Path |
|---|---|
| POST | /api/chat |
| POST | /api/v1/widget/init |
| POST | /api/v1/widget/message |
Conversations
| Method | Path |
|---|---|
| GET | /api/conversations |
| GET | /api/conversations/[id] |
| GET | /api/conversations/[id]/messages |
Analytics
| Method | Path |
|---|---|
| GET | /api/analytics |
Knowledge Base
| Method | Path |
|---|---|
| GET | /api/knowledge |
| POST | /api/knowledge |
| GET | /api/knowledge/sources |
| POST | /api/knowledge/sources |
Channels
| Method | Path |
|---|---|
| GET | /api/tenant/channels |
| GET | /api/tenant/channels/[channelId] |
| PUT | /api/tenant/channels/[channelId] |
| POST | /api/tenant/voices |
| GET | /api/tenant/voices |
Agents & Team
| Method | Path |
|---|---|
| GET | /api/agents |
| POST | /api/agents |
| PUT | /api/agents |
Escalations
| Method | Path |
|---|---|
| GET | /api/escalations |
| POST | /api/escalations |
| PUT | /api/escalations |
Channel Webhooks
| Method | Path |
|---|---|
| POST | /api/channels/whatsapp |
| POST | /api/channels/sms |
| POST | /api/channels/ussd |
| POST | /api/channels/twitter |
| POST | /api/v1/voice/inbound |
| POST | /api/v1/voice/status |
| POST | /api/v1/channels/telegram/webhook |
| POST | /api/v1/channels/meta/webhook |
Example: Send a Chat Message
Request
bash
curl -X POST https://bankmind.aihookd.site/api/chat \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"message": "What are the requirements for a personal loan?",
"conversationId": "conv_abc123",
"channel": "widget"
}'Response (200 OK)
json
{
"response": "To apply for a personal loan, you'll need: 1) A valid national ID, 2) Proof of income (last 3 payslips), 3) Bank statements for the last 6 months, 4) A minimum monthly income of KES 30,000.",
"conversationId": "conv_abc123",
"messageId": "msg_xyz789",
"metadata": {
"intent": "loan_inquiry",
"confidence": 0.94,
"agentType": "loan",
"tokensUsed": 87
}
}Example: List Conversations
Request
bash
curl https://bankmind.aihookd.site/api/conversations \
-H "Authorization: Bearer YOUR_API_KEY"Response (200 OK)
json
{
"conversations": [
{
"id": "conv_abc123",
"channel": "whatsapp",
"status": "active",
"customer_phone": "+254712345678",
"message_count": 12,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:45:00Z"
}
],
"total": 1,
"page": 1,
"limit": 20
}Error Format
All errors follow a consistent JSON format:
Error response
json
{
"error": "Human-readable error message",
"code": "ERROR_CODE"
}| Status | Code | Meaning |
|---|---|---|
| 401 | AUTH_INVALID | Missing or invalid credentials |
| 403 | FORBIDDEN | Insufficient permissions |
| 404 | NOT_FOUND | Resource not found |
| 422 | VALIDATION | Invalid request body |
| 429 | RATE_LIMIT | Too many requests |
| 500 | INTERNAL | Server error |
| 502 | EXTERNAL | Third-party service error |