📡 REST API Reference
All API endpoints are prefixed with /api/ and require authentication via session cookie. All requests and responses use Content-Type: application/json.
Conversations
| Endpoint | Method | Description |
|---|---|---|
/api/conversations | GET | List conversations (filters: status, channel_type, tag, search, page) |
/api/conversations/{id} | GET | Get conversation (resets unread_count) |
/api/conversations | POST | Create conversation |
/api/conversations/{id}/status | POST | Update status |
/api/conversations/{id}/tags | POST | Add tag |
/api/conversations/{id}/tags/{tag} | DELETE | Remove tag |
/api/conversations/{id}/assign | POST | Assign agent |
Messages
| Endpoint | Method | Description |
|---|---|---|
/api/conversations/{id}/messages | GET | List messages |
/api/conversations/{id}/messages | POST | Send message |
AI Suggest
| Endpoint | Method | Description |
|---|---|---|
/api/ai-suggest?conversation_id={id} | GET | Get AI reply suggestion |
Contacts
| Endpoint | Method | Description |
|---|---|---|
/api/contacts | GET | List contacts |
/api/contacts/{id} | GET | Get contact |
/api/contacts | POST | Create contact |
/api/contacts/{id} | PATCH | Update contact |
/api/contacts/{id} | DELETE | Delete contact (admin) |
Channels (Admin only)
| Endpoint | Method | Description |
|---|---|---|
/api/channels | GET | List channels |
/api/channels | POST | Create channel |
/api/channels/{id} | PATCH | Update channel |
/api/channels/{id} | DELETE | Delete channel |
Automations (Admin only)
| Endpoint | Method | Description |
|---|---|---|
/api/automations | GET | List automations |
/api/automations | POST | Create automation |
/api/automations/{id}/toggle | POST | Toggle active/inactive |
/api/automations/{id} | DELETE | Delete automation |
Analytics
| Endpoint | Method | Description |
|---|---|---|
/api/analytics?days=30 | GET | Get analytics data |
Agents (Admin only)
| Endpoint | Method | Description |
|---|---|---|
/api/agents | GET | List agents |
/api/agents | POST | Create agent |
/api/agents/{id}/role | POST | Update role |
/api/agents/{id} | DELETE | Delete agent |
Settings
| Endpoint | Method | Description |
|---|---|---|
/api/settings/workspace | GET | Get workspace settings |
/api/settings/workspace | POST | Update workspace (admin) |
/api/settings/password | POST | Change password |
Error Format
{"error": "Human-readable error message"}
| Code | Meaning |
|---|---|
200 | Success |
201 | Created |
400 | Bad Request |
401 | Unauthenticated |
403 | Forbidden |
404 | Not Found |
409 | Conflict |
500 | Internal Error |