Voice API Overview
Build programmable voice applications with outbound and inbound calls, text-to-speech, speech recognition, DTMF-driven IVR, call recording, and multi-party conferencing across Africa.
🚀 Quick Start
curl -X POST https://api.afriroute.ai/api/v1/voice/call \
-H "Authorization: Bearer $AFRIROUTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"from": "+251116000000",
"to": "+251911234567",
"answer_url": "https://yourapp.com/voice/answer"
}'
🔑 Authentication
All requests use a Bearer token and the base URL https://api.afriroute.ai:
Authorization: Bearer $AFRIROUTE_API_KEY
Phone numbers are always in E.164 format (e.g. +251911234567).
📡 Core Endpoints
POST /v1/voice/call # Initiate an outbound call
GET /v1/voice/call/:call_id # Retrieve call status
POST /v1/voice/conference # Create a conference room
POST /v1/voice/agent/login # Log a call-center agent in
When a call connects, AfriRoute fetches your answer_url, which returns an NCCO (Nexus Call Control Object) — a JSON array of instructions that control the call.
🎙️ NCCO Actions
| Action | Purpose |
|---|---|
talk | Text-to-speech playback |
stream | Play an audio file (MP3/WAV) |
input | Collect DTMF digits or speech |
connect | Bridge the call to a phone, SIP, or conference |
record | Record the call or a segment |
conversation | Join a named conference room |
Example NCCO
[
{ "action": "talk", "text": "Welcome to AfriRoute. Please hold." },
{ "action": "connect", "endpoint": [{ "type": "phone", "number": "+251911234567" }] }
]
🔔 Call Events
Set an event_url to receive lifecycle webhooks:
| Event | Description |
|---|---|
started | Call initiated |
ringing | Recipient is ringing |
answered | Call answered |
completed | Call ended normally |
failed | Call failed |
busy | Recipient busy |
timeout | No answer |
🌍 Languages
- Text-to-Speech: 40+ languages including English, French, Portuguese, Arabic, Swahili, Amharic, Hausa, and Yoruba.
- Speech Recognition: 20+ languages including English, French, Swahili, Amharic, Yoruba, and Zulu.
💡 Best Practices
- Return NCCO quickly from
answer_url; cache static menus. - Always set an
event_urlto track every call state. - Offer an operator escape (
Press 0) on every IVR menu. - Provide DTMF fallback when speech recognition fails.
- Obtain consent before recording where legally required.
💰 Pricing
| Type | Price/Minute |
|---|---|
| Outbound (Local) | $0.05 |
| Outbound (International) | $0.15 |
| Inbound | $0.02 |
| TTS (Premium) | $0.03 |
| Recording | $0.005 |
📚 Related Resources
Need help? Contact Support → | Last Updated: May 2026