Voice API - Programmable PSTN & VoIP Calls
The EnableX Voice API lets you build voice applications — outbound dialing, IVR systems, conferencing, call recording, and real-time call control. Control calls in real-time from your server through our webhook-driven architecture, deployed across 50+ countries.
What is the Voice API?
The EnableX Voice API is a REST-based platform for programmable voice. Unlike traditional PBX systems or simple request-response APIs, the Voice API is webhook-driven. Your application initiates a call, and then your server receives real-time webhooks for every call event — when someone answers, when they press a key, when they speak. You respond to each webhook with an action (play audio, collect input, transfer the call), and the platform executes it. This gives you complete control over the call flow.
The Voice API is fundamentally different from request-response APIs. You initiate a call, but you don't get the result back in the response. Instead, the platform sends your webhook endpoint events as the call progresses. Your server must respond to each webhook with a valid JSON action within 5 seconds, or the call may terminate. Understanding this model is critical before you build.
What You Can Build
With the Voice API, you can build:
- Outbound calls — Dial from your application to any phone number. Answer detection, callback handling, caller ID control.
- IVR (Interactive Voice Response) — Play menus, collect DTMF input, route based on user input, build complex call trees.
- Inbound call routing — Receive calls on DID numbers, route to agents, voicemail, or external systems.
- Call recording — Record inbound or outbound calls for compliance, training, or quality assurance.
- Call Bridging — Connect two call legs together to form a two-party conversation. See Call Bridging in the Voice API Reference.
- Text-to-speech (TTS) — Play dynamically generated audio announcements, confirmations, or alerts.
- Speech-to-text (ASR) & DTMF collection — Collect voice input or keypad presses, feed into AI systems.
How It Works (The Control Loop)
The Voice API works through a simple loop:
- Initiate — Your app server calls POST /voice/v1/call with a phone number and your webhook URL.
- Event — The EnableX platform dials the number. When something happens (call answered, key pressed, timeout), it sends a webhook POST to your server.
- Respond — Your server receives the webhook, processes it, and responds with a JSON action (talk, play, collect, transfer, hangup, etc.).
- Execute — The platform executes the action and waits for the next event.
- Repeat — Steps 2–4 repeat until the call ends.
This loop continues until you hang up the call or the caller disconnects. Your server stays in control the entire time.
Key API Operations
| Operation | Method | Endpoint | Purpose |
|---|---|---|---|
| Initiate Outbound Call | POST | /voice/v1/call | Dial a phone number. Specify action_on_connect to play audio or bridge immediately on answer. |
| Accept Inbound Call | POST | /voice/v1/call/{voice_id}/accept | Accept an inbound call and begin controlling it via subsequent API calls. |
| Play Voice Prompt | PUT | /voice/v1/call/{voice_id}/play | Play audio to the caller — pre-recorded prompt, TTS, SSML, or a URL-hosted file. Optionally enable DTMF or ASR to collect a response. |
| Connect (Bridge) Call | POST | /voice/v1/call/{voice_id}/connect | Bridge the active call leg to a second phone number, creating a two-party conversation. |
| Hold / Unhold | POST | /voice/v1/call/{voice_id}/hold | Place the caller on hold or resume a held call. |
| Start Recording | POST | /voice/v1/call/{voice_id}/record/start | Begin recording the active call leg. |
| Stop Recording | POST | /voice/v1/call/{voice_id}/record/stop | Stop an active recording. The recording URL is delivered via webhook. |
| Hang Up | DELETE | /voice/v1/call/{voice_id} | Terminate the call and release all associated resources. |
Authentication
All Voice API requests use HTTP Basic Authentication. Encode your App ID and App Key as Base64(APP_ID:APP_KEY) and pass it in the Authorization header. The example below initiates an outbound call that plays a TTS prompt when answered:
curl -X POST https://api.enablex.io/voice/v1/call \
-H "Authorization: Basic $(echo -n 'APP_ID:APP_KEY' | base64)" \
-H "Content-Type: application/json" \
-d '{
"name": "my-service",
"from": "Your_EnableX_Number",
"to": "Destination_Number",
"action_on_connect": {
"play": {
"text": "Hello! This is a test call from EnableX.",
"language": "en-US",
"voice": "female"
}
},
"event_url": "https://yourdomain.com/webhook"
}'
Your App ID and App Key are found in the EnableX Portal under Project Settings › API Credentials. Keep your App Key secure — never commit it to version control or expose it in client-side code.
Documentation Map
Start here based on what you're building:
I'm New to Voice API
- Platform Architecture — Understand the webhook control loop and call lifecycle.
- Prerequisites — Set up your project, provision numbers, understand compliance.
- Quickstart — Make your first call in 10 minutes.
I'm Building Outbound Calls
- Outbound Calls Guide — Initiate calls, handle events, play audio, collect input, transfer.
- API Reference — Complete endpoint and parameter documentation.
I'm Building an IVR
- Platform Architecture — Understand the action chaining model.
- IVR Guide — Menu design, DTMF collection, routing logic.
I'm Building Call Recording
- Recording Guide — Record inbound, outbound, and conference calls.
- Compliance — Understand country-specific recording laws.
I'm Receiving Inbound Calls
- Prerequisites — Provision a DID number.
- Inbound Calls Guide — Configure webhooks, implement routing patterns.
I Need Reference Docs
- API Reference — All endpoints, parameters, response schemas.
- Error Codes & Troubleshooting — Diagnose issues.
- Webhook Reference — All webhook event types and payloads.
Frequently Asked Questions
What can I build with the EnableX Voice API?
The EnableX Voice API supports outbound call campaigns, inbound IVR systems, call masking (number privacy), click-to-call widgets, interactive voice response, conference bridges, automated voice broadcasts, voicemail detection, and real-time call recording. Any voice application that requires programmatic call control can be built on it.
Does the EnableX Voice API support inbound and outbound calls?
Yes. For outbound calls, your server sends a REST request to initiate the call. For inbound calls, EnableX rings the configured webhook URL on your server when a call arrives on your number, and your server responds with call-control instructions in real time.
Which countries does the EnableX Voice API support?
EnableX Voice API supports 50+ countries for outbound dialling and phone number provisioning. You can purchase local, national, and toll-free numbers for most regions directly from the EnableX Portal.
Can I record calls made through the EnableX Voice API?
Yes. Recording can be initiated on any active call leg via the API and is delivered to cloud storage or your own S3-compatible bucket. Both full-call and partial recording are supported.
How does the webhook-driven architecture work?
When a call event occurs such as a call connecting, a digit being pressed, or a call ending, EnableX sends an HTTP POST to your webhook URL with event data. Your server reads the data and responds with JSON instructions telling EnableX what to do next: play a prompt, transfer the call, record, or hang up.
Is the EnableX Voice API free to try?
New accounts receive trial credits on the EnableX Portal. You can make test calls and explore all API features during the trial period without any upfront billing commitment.