Complete API Documentation
This document provides comprehensive API documentation for the Syntera platform, covering all microservices and frontend API endpoints.
All API endpoints require authentication. Syntera uses Supabase Auth with JWT tokens.
Authorization: Bearer <supabase-jwt-token>
Content-Type: application/json
All endpoints are scoped to the authenticated user's company via Row Level Security.
POST /api/agentsRequest Body:
{
"name": "Customer Support Agent",
"description": "Handles customer inquiries",
"system_prompt": "You are a helpful customer support agent...",
"model": "gpt-4o-mini",
"temperature": 0.7,
"max_tokens": 2000,
"enabled": true,
"voice_settings": {
"voice": "alloy",
"language": "en"
}
}Response:
{
"id": "uuid",
"name": "Customer Support Agent",
"company_id": "uuid",
"enabled": true,
"created_at": "2024-01-01T00:00:00Z"
}GET /api/agentsResponse:
{
"agents": [
{
"id": "uuid",
"name": "Sales Agent",
"description": "Handles sales inquiries",
"model": "gpt-4-turbo",
"enabled": true,
"created_at": "2024-01-01T00:00:00Z"
}
]
}PATCH /api/agents/:idRequest Body: (partial updates supported)
{
"name": "Updated Agent Name",
"enabled": false
}DELETE /api/agents/:idGET /api/conversations?limit=20&offset=0&status=endedQuery Parameters:
limit: Number of conversations (default: 20, max: 50)offset: Pagination offset (default: 0)status: Filter by status (active,ended,archived)
Response:
{
"conversations": [
{
"id": "uuid",
"agent_id": "uuid",
"channel": "chat",
"status": "ended",
"started_at": "2024-01-01T00:00:00Z",
"ended_at": "2024-01-01T00:05:00Z",
"contact_id": "uuid",
"metadata": {
"source": "website",
"ip_address": "192.168.1.1"
}
}
],
"total": 150
}GET /api/conversations/:id/messagesResponse:
{
"messages": [
{
"id": "uuid",
"conversation_id": "uuid",
"sender_type": "user",
"content": "Hello, I need help",
"created_at": "2024-01-01T00:00:00Z"
},
{
"id": "uuid",
"conversation_id": "uuid",
"sender_type": "agent",
"content": "I'd be happy to help you!",
"ai_metadata": {
"model": "gpt-4o-mini",
"tokens_used": 150
},
"created_at": "2024-01-01T00:00:01Z"
}
]
}POST /api/conversations/:id/messagesRequest Body:
{
"content": "User message here",
"attachments": [
{
"url": "https://example.com/file.pdf",
"type": "application/pdf",
"name": "document.pdf",
"size": 1024000
}
]
}GET /api/analytics/overview?startDate=2024-01-01&endDate=2024-01-31Response:
{
"totalConversations": 1250,
"activeConversations": 45,
"activeAgents": 8,
"avgResponseTime": 850,
"userSatisfaction": 4.2
}GET /api/analytics/conversations?startDate=2024-01-01&endDate=2024-01-31&groupBy=dayResponse:
{
"timeline": [
{
"date": "2024-01-01",
"count": 45
}
],
"byChannel": [
{
"channel": "chat",
"count": 800
},
{
"channel": "voice",
"count": 200
}
],
"avgDuration": 420
}GET /api/analytics/costs?startDate=2024-01-01&endDate=2024-01-31Response:
{
"totalTokens": 1500000,
"estimatedCost": 2.25
}GET /api/analytics/agents?startDate=2024-01-01&endDate=2024-01-31Response:
{
"agents": [
{
"agentId": "uuid",
"agentName": "Support Agent",
"conversationCount": 150,
"avgResponseTime": 780,
"satisfaction": 4.1
}
]
}GET /api/crm/contacts?limit=20&offset=0&search=johnResponse:
{
"contacts": [
{
"id": "uuid",
"email": "john@example.com",
"first_name": "John",
"last_name": "Doe",
"company_name": "Acme Corp",
"tags": ["lead"],
"created_at": "2024-01-01T00:00:00Z"
}
],
"total": 250
}POST /api/crm/contactsRequest Body:
{
"email": "jane@example.com",
"first_name": "Jane",
"last_name": "Smith",
"company_name": "Tech Corp",
"tags": ["prospect"]
}GET /api/crm/deals?stage=qualified&limit=20Response:
{
"deals": [
{
"id": "uuid",
"title": "License",
"value": 50000,
"stage": "proposal",
"probability": 75,
"contact_id": "uuid",
"expected_close_date": "2024-02-01"
}
],
"total": 45
}POST /api/knowledge-base/upload
Content-Type: multipart/form-dataForm Data:
file: PDF, DOCX, or TXT filetitle: Document titledescription: Optional description
Response:
{
"id": "uuid",
"title": "Product Documentation",
"status": "processing",
"chunk_count": 150,
"created_at": "2024-01-01T00:00:00Z"
}POST /api/knowledge-base/searchRequest Body:
{
"query": "refund policy",
"limit": 5,
"threshold": 0.7
}Response:
{
"results": [
{
"document_id": "uuid",
"chunk_id": "uuid",
"content": "Our refund policy allows...",
"score": 0.85,
"metadata": {
"source": "policy.pdf",
"page": 12
}
}
]
}GET /api/knowledge-baseResponse:
{
"documents": [
{
"id": "uuid",
"title": "User Guide",
"description": "Complete user manual",
"status": "processed",
"chunk_count": 200,
"created_at": "2024-01-01T00:00:00Z"
}
]
}GET /api/workflowsResponse:
{
"workflows": [
{
"id": "uuid",
"name": "Lead Qualification",
"description": "Automatically qualify and route leads",
"enabled": true,
"trigger_type": "conversation_started",
"created_at": "2024-01-01T00:00:00Z"
}
]
}POST /api/workflowsRequest Body:
{
"name": "Support Escalation",
"description": "Escalate urgent issues",
"trigger_type": "message_received",
"trigger_config": {
"keywords": ["urgent", "emergency"]
},
"nodes": [...],
"edges": [...]
}POST /api/workflows/:id/testRequest Body:
{
"testData": {
"message": "This is urgent!",
"conversation_id": "uuid"
}
}GET /api/workflows/:id/executions?limit=10Response:
{
"executions": [
{
"id": "uuid",
"status": "success",
"triggered_by": "message_received",
"execution_time_ms": 150,
"executed_at": "2024-01-01T00:00:00Z"
}
]
}GET /api/notifications?limit=20&read=falsePOST /api/notifications/:id/readPOST /api/notifications/read-allGET /api/notifications/unread-countGET /public/agents/:id
POST /public/conversations
POST /public/conversations/:id/messagesGET /public/livekit/tokenPOST /public/voice-bot/deployAll APIs return standardized error responses:
{
"error": "Error message description",
"code": "ERROR_CODE",
"details": {}
}200: Success201: Created400: Bad Request401: Unauthorized403: Forbidden404: Not Found429: Rate Limited500: Internal Server Error
- 1000 requests per hour per user
- Rate limit headers included in responses
- Row Level Security: All data scoped to company
- JWT Authentication: Bearer token required
- Input Validation: Zod schemas on all endpoints
- GDPR Compliance: Data export and deletion capabilities
- Audit Logging: All API calls logged for compliance
For API integration questions or issues:
- Check the error response details
- Review the request/response examples above
- Test with the live demo at https://syntera-tau.vercel.app/