Voice Agents API
The Voice Agents API enables you to create and manage voice-enabled AI agents with text-to-speech (TTS) and speech-to-text (STT) capabilities. Voice agents can handle real-time voice conversations using ElevenLabs voices and LiveKit for WebRTC communication.
Base URL
https://api.aloochat.ai/api/publicAuthentication
All requests require an API key in the x-api-key header:
x-api-key: your_api_key_hereEndpoints Overview
| Method | Endpoint | Description |
|---|---|---|
GET | /voice-agents | List all voice agents |
POST | /voice-agents | Create a new voice agent |
PUT | /voice-agents/{id} | Update a voice agent |
DELETE | /voice-agents/{id} | Delete a voice agent |
GET | /voice-agents/arabic | Get curated Arabic voices |
GET | /voice-agents/english | Get curated English voices |
GET | /voice-agents/multilingual | Get multilingual voices |
POST | /voice-agents/elevenlabs/voices/{voiceId}/tts | Text-to-speech |
POST | /voice-agents/stt | Speech-to-text |
Voice Agent Properties
| Property | Type | Description |
|---|---|---|
id | string | Unique voice agent identifier (UUID) |
name | string | Voice agent name |
description | string | Description of the voice agent |
voice_id | string | ElevenLabs voice ID |
voice_name | string | Human-readable voice name |
language | string | Primary language code |
model_id | string | ElevenLabs model ID (default: “eleven_turbo_v2_5”) |
active | boolean | Whether the voice agent is active |
temperature | number | Response creativity (0.0-1.0) |
voice_speed | number | Speech speed percentage (100 = normal) |
voice_stability | number | Voice stability (0.0-1.0) |
voice_similarity_boost | number | Voice similarity boost (0.0-1.0) |
voice_style | number | Style exaggeration (0.0-1.0) |
output_format | string | Audio format (e.g., “mp3_44100_128”) |
company_id | string | Associated company ID |
main_agent_id | string | Linked main agent ID |
List Voice Agents
Retrieve all voice agents for your company.
Endpoint: GET /voice-agents
curl -X GET "https://api.aloochat.ai/api/public/voice-agents" \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json"Response
[
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Sarah - Customer Support",
"description": "Friendly female voice for customer support",
"voice_id": "EXAVITQu4vr4xnSDxMaL",
"voice_name": "Sarah",
"language": "en",
"model_id": "eleven_turbo_v2_5",
"active": true,
"temperature": 0.7,
"voice_speed": 100.0,
"voice_stability": 0.5,
"voice_similarity_boost": 0.5,
"voice_style": 0.0,
"output_format": "mp3_44100_128",
"company_id": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
]Create Voice Agent
Create a new voice agent with custom voice settings.
Endpoint: POST /voice-agents
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Voice agent name |
voice_id | string | Yes | ElevenLabs voice ID |
description | string | No | Description |
voice_name | string | No | Human-readable voice name |
language | string | No | Language code (e.g., “en”, “ar”) |
model_id | string | No | ElevenLabs model ID |
active | boolean | No | Whether active (default: false) |
temperature | number | No | Creativity level (default: 0.7) |
voice_speed | number | No | Speed percentage (default: 100) |
voice_stability | number | No | Stability (default: 0.5) |
voice_similarity_boost | number | No | Similarity boost (default: 0.5) |
voice_style | number | No | Style exaggeration (default: 0.0) |
main_agent_id | string | No | Link to main agent |
curl -X POST "https://api.aloochat.ai/api/public/voice-agents" \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Customer Support Voice",
"voice_id": "EXAVITQu4vr4xnSDxMaL",
"voice_name": "Sarah",
"description": "Friendly female voice for customer support",
"language": "en",
"model_id": "eleven_turbo_v2_5",
"active": true,
"temperature": 0.7,
"voice_speed": 100.0,
"voice_stability": 0.5,
"voice_similarity_boost": 0.75,
"voice_style": 0.0,
"output_format": "mp3_44100_128"
}'Response
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Customer Support Voice",
"description": "Friendly female voice for customer support",
"voice_id": "EXAVITQu4vr4xnSDxMaL",
"voice_name": "Sarah",
"language": "en",
"model_id": "eleven_turbo_v2_5",
"active": true,
"temperature": 0.7,
"voice_speed": 100.0,
"voice_stability": 0.5,
"voice_similarity_boost": 0.75,
"voice_style": 0.0,
"output_format": "mp3_44100_128",
"company_id": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}Update Voice Agent
Update an existing voice agent’s settings.
Endpoint: PUT /voice-agents/{id}
curl -X PUT "https://api.aloochat.ai/api/public/voice-agents/550e8400-e29b-41d4-a716-446655440000" \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Voice Agent",
"voice_stability": 0.7,
"voice_speed": 110.0,
"active": true
}'Delete Voice Agent
Delete a voice agent.
Endpoint: DELETE /voice-agents/{id}
curl -X DELETE "https://api.aloochat.ai/api/public/voice-agents/550e8400-e29b-41d4-a716-446655440000" \
-H "x-api-key: your_api_key_here"Get Available Voices
Arabic Voices
Get curated Arabic voices from ElevenLabs.
Endpoint: GET /voice-agents/arabic
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
gender | string | Filter by gender (“male” or “female”) |
curl -X GET "https://api.aloochat.ai/api/public/voice-agents/arabic?gender=female" \
-H "x-api-key: your_api_key_here"English Voices
Get curated English voices from ElevenLabs.
Endpoint: GET /voice-agents/english
Query Parameters:
| Parameter | Type | Description |
|---|---|---|
gender | string | Filter by gender |
category | string | Filter by category |
accent | string | Filter by accent |
featured_only | boolean | Only featured voices |
max_voices | integer | Maximum voices to return (default: 100) |
Multilingual Voices
Get voices that support multiple languages (Arabic and English).
Endpoint: GET /voice-agents/multilingual
Text-to-Speech (TTS)
Convert text to speech using a specific voice.
Endpoint: POST /voice-agents/elevenlabs/voices/{voiceId}/tts
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
text | string | Yes | Text to convert to speech |
model_id | string | No | ElevenLabs model ID |
language_code | string | No | Language code (e.g., “en”, “ar”) |
voice_speed | number | No | Speed percentage |
voice_stability | number | No | Stability (0.0-1.0) |
voice_similarity_boost | number | No | Similarity boost (0.0-1.0) |
voice_style | number | No | Style exaggeration (0.0-1.0) |
output_format | string | No | Audio format |
curl -X POST "https://api.aloochat.ai/api/public/voice-agents/elevenlabs/voices/EXAVITQu4vr4xnSDxMaL/tts" \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello! Welcome to our customer support. How can I help you today?",
"model_id": "eleven_turbo_v2_5",
"language_code": "en",
"voice_stability": 0.5,
"voice_similarity_boost": 0.75
}' \
--output audio.mp3Speech-to-Text (STT)
Convert speech audio to text.
Endpoint: POST /voice-agents/stt
Content-Type: multipart/form-data
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
file | file | Yes | Audio file to transcribe |
curl -X POST "https://api.aloochat.ai/api/public/voice-agents/stt" \
-H "x-api-key: your_api_key_here" \
-F "file=@audio.mp3"Response
{
"text": "Hello, I need help with my order."
}Error Responses
| Status Code | Description |
|---|---|
400 | Bad Request - Invalid input data |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - Insufficient permissions |
404 | Not Found - Voice agent not found |
429 | Too Many Requests - Rate limit exceeded |
500 | Internal Server Error |
Error Response Format
{
"detail": "Voice agent not found"
}