All API requests require authentication using an API key. Include your API key in the Authorization header:
Authorization: Bearer va_your_api_key_hereYou can create and manage API keys in the API Keys section.
/api/v1API requests are rate-limited to 1000 requests per minute per API key.
Rate limit headers are included in responses:
X-RateLimit-Limit - Maximum requests allowedX-RateLimit-Remaining - Remaining requests in windowX-RateLimit-Reset - Unix timestamp when limit resetsAll responses follow a standard format:
{
"success": true,
"data": { ... },
"meta": {
"timestamp": "2024-01-01T00:00:00.000Z",
"request_id": "uuid-here"
}
}{
"success": false,
"error": "Error message",
"details": { ... },
"meta": {
"timestamp": "2024-01-01T00:00:00.000Z",
"request_id": "uuid-here"
}
}/agentsList all agents for your organization
Query Parameters:
enabled - Filter by enabled status (true/false)limit - Number of results (default: 50, max: 100)offset - Pagination offset (default: 0)curl -X GET "https://your-domain.com/api/v1/agents?enabled=true&limit=10" \
-H "Authorization: Bearer va_your_api_key"/agents/:idGet agent details by ID
/agentsCreate a new agent
curl -X POST "https://your-domain.com/api/v1/agents" \
-H "Authorization: Bearer va_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Customer Service Agent",
"system_prompt": "You are a helpful customer service agent...",
"description": "Handles customer inquiries",
"starting_message": "Hello! How can I help you today?",
"enabled": true,
"voice_settings": {
"stability": 0.5,
"similarity_boost": 0.75
}
}'Request Body Fields:
name (required) - Agent namesystem_prompt (required) - System prompt for the agentdescription (optional) - Agent descriptionstarting_message (optional) - Initial message to start conversationsenabled (optional) - Whether agent is enabled (default: true)voice_settings (optional) - ElevenLabs voice settings objectdtmf_rules (optional) - DTMF input rules configuration/agents/:idUpdate an agent (partial update - only include fields to update)
Updatable Fields:
name - Agent namedescription - Agent descriptionsystem_prompt - System promptstarting_message - Initial messagevoice_settings - Voice settingsdtmf_rules - DTMF rulesenabled - Enable/disable status/agents/:idDelete an agent (only if no active tasks)
/tasksList tasks with optional filtering
Query Parameters:
agent_id - Filter by agent IDstatus - Filter by status (pending, in_progress, completed, failed)limit - Number of results (default: 50, max: 100)offset - Pagination offset (default: 0)/tasksCreate a new task
curl -X POST "https://your-domain.com/api/v1/tasks" \
-H "Authorization: Bearer va_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "uuid-here",
"name": "Call customer",
"to_number": "+1234567890",
"description": "Follow up call",
"starting_message": "Hello, this is a call from our company",
"context_data": {
"customer_name": "John Doe",
"order_id": "12345"
},
"priority": 0,
"scheduled_at": null,
"webhook_url": "https://your-app.com/webhooks",
"webhook_events": ["call_started", "call_completed"]
}'/tasks/:idGet task details including agent information
/tasks/:idUpdate a task (only allowed for pending tasks)
Updatable Fields:
name - Task namedescription - Task descriptionto_number - Phone number (E.164 format)starting_message - Initial messagecontext_data - Context data objectpriority - Priority levelscheduled_at - Scheduled execution timewebhook_url - Webhook URLwebhook_events - Array of webhook events/tasks/:idDelete a task (only allowed for pending or failed tasks)
/tasks/:id/executeExecute a pending task (initiate phone call)
{
"success": true,
"data": {
"call_id": "uuid-here",
"message": "Call initiated"
}
}/tasks/:id/resetReset a task status to pending (allows re-execution)
Only works for tasks that are not already pending
/callsList calls with optional filtering
Query Parameters:
task_id - Filter by task IDagent_id - Filter by agent IDstatus - Filter by status (initiated, in_progress, completed, failed)limit - Number of results (default: 50, max: 100)offset - Pagination offset (default: 0)/calls/:idGet call details including transcript and report
/calls/:id/transcriptGet call transcript (returns stored transcript if available)
/calls/:id/transcriptManually fetch and process transcript from ElevenLabs API
Fetches transcript from ElevenLabs, processes it, generates report, and stores in database. Returns transcript, extracted data, and report.
/calls/:id/reportGet call report (generated on-the-fly if not exists)
/calls/:id/recordingGet audio recording URL for a completed call
Returns a proxy URL that handles authentication. The recording must be available (call status: completed or failed).
curl -X GET "https://your-domain.com/api/v1/calls/{call_id}/recording" \
-H "Authorization: Bearer va_your_api_key"Note: Use /calls/:id/recording/stream to stream the audio directly.
/calls/:id/liveGet WebSocket connection information for live transcript streaming
/calls/:id/endEnd/terminate an active call
curl -X POST "https://your-domain.com/api/v1/calls/{call_id}/end" \
-H "Authorization: Bearer va_your_api_key"/calls/:id/cancelCancel an active call (marks as failed)
Connect to a WebSocket endpoint to receive real-time transcript updates during active calls.
First, get the WebSocket URL for a call:
GET /api/v1/calls/:id/live
Authorization: Bearer va_your_api_key
Response:
{
"success": true,
"data": {
"websocket_url": "ws://localhost:3008/ws/calls/{call_id}",
"call_id": "{call_id}",
"temp_token": "base64_encoded_token",
"connection_info": {
"url": "ws://localhost:3008/ws/calls/{call_id}",
"auth_method": "query_param",
"auth_param": "api_key",
"temp_auth_param": "session_token",
"example": "ws://localhost:3008/ws/calls/{call_id}?api_key=YOUR_API_KEY",
"example_session": "ws://localhost:3008/ws/calls/{call_id}?session_token=TEMP_TOKEN",
"message_format": "json",
"message_types": [
"connected",
"transcript_update",
"call_status_update",
"error"
]
}
}
}Authentication: You can connect using either your API key (?api_key=YOUR_API_KEY) or a temporary session token (?session_token=TEMP_TOKEN) returned in the response. The session token is valid for 5 minutes and is useful for browser-based applications.
Connect to the WebSocket URL with your API key or session token:
// Using API key
const ws = new WebSocket('ws://localhost:3008/ws/calls/{call_id}?api_key=YOUR_API_KEY');
// Or using session token (from /calls/:id/live response)
const ws = new WebSocket('ws://localhost:3008/ws/calls/{call_id}?session_token=TEMP_TOKEN');
ws.on('message', (data) => {
const message = JSON.parse(data);
switch(message.type) {
case 'connected':
console.log('Connected to live transcript stream');
break;
case 'transcript_update':
console.log('Transcript update:', message.data.transcript);
break;
case 'call_status_update':
console.log('Call status:', message.data.status);
break;
case 'error':
console.error('Error:', message.error);
break;
}
});connected - Sent when connection is establishedtranscript_update - Real-time transcript updates during the callcall_status_update - Call status changes (in_progress, completed, failed)error - Error messagesSend a ping message to keep the connection alive:
ws.send(JSON.stringify({ type: 'ping' }));You can configure webhooks on tasks to receive notifications when call events occur.
When creating or updating a task, include:
webhook_url - Your webhook endpoint URL (must be HTTPS)webhook_events - Array of events to subscribe to:call_started - When call is initiatedcall_completed - When call completes successfullycall_failed - When call fails{
"event_type": "call_completed",
"task_id": "uuid-here",
"call_id": "uuid-here",
"status": "completed",
"data": {
"transcript_excerpt": "...",
"report_excerpt": "..."
}
}Webhooks are sent with a 10-second timeout. If your endpoint doesn't respond within 10 seconds, the webhook is considered failed. Failed webhooks are logged but do not block call processing.
400 - Bad Request (validation error)401 - Unauthorized (invalid or missing API key)403 - Forbidden (insufficient permissions)404 - Not Found (resource doesn't exist)429 - Too Many Requests (rate limit exceeded)500 - Internal Server Error503 - Service Unavailable (external service error)system_prompt (not prompt)starting_message for initial conversation messagesvoice_settings object (ElevenLabs format)dtmf_rules objectAll phone numbers must be in E.164 format: +[country code][number]
Example: +1234567890 (US), +442071234567 (UK)
pending - Task created but not executedin_progress - Call is activecompleted - Call completed successfullyfailed - Call failed or was cancelledinitiated - Call initiated but not yet connectedin_progress - Call is activecompleted - Call completed successfullyfailed - Call failed or was cancelledRecording URLs returned by the API are proxy endpoints that handle authentication automatically. For streaming audio directly, use the /calls/:id/recording/stream endpoint.
Most endpoints use API key authentication. However, some management endpoints require session authentication:
These endpoints use session cookies instead of API keys for security reasons.
const response = await fetch('https://your-domain.com/api/v1/agents', {
headers: {
'Authorization': 'Bearer va_your_api_key',
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);import requests
headers = {
'Authorization': 'Bearer va_your_api_key',
'Content-Type': 'application/json'
}
response = requests.get(
'https://your-domain.com/api/v1/agents',
headers=headers
)
data = response.json()
print(data)curl -X GET "https://your-domain.com/api/v1/agents" \
-H "Authorization: Bearer va_your_api_key"