Skip to main content

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​

ActionPurpose
talkText-to-speech playback
streamPlay an audio file (MP3/WAV)
inputCollect DTMF digits or speech
connectBridge the call to a phone, SIP, or conference
recordRecord the call or a segment
conversationJoin 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:

EventDescription
startedCall initiated
ringingRecipient is ringing
answeredCall answered
completedCall ended normally
failedCall failed
busyRecipient busy
timeoutNo 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.

View all TTS languages →

💡 Best Practices​

  • Return NCCO quickly from answer_url; cache static menus.
  • Always set an event_url to 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​

TypePrice/Minute
Outbound (Local)$0.05
Outbound (International)$0.15
Inbound$0.02
TTS (Premium)$0.03
Recording$0.005

View detailed pricing →


Need help? Contact Support → | Last Updated: May 2026