Programmable Voice API Overview
Twilio's Voice API helps you to make, receive, and monitor calls around the world.
Using this REST API, you can make outgoing calls, modify calls in progress, and query metadata about calls you've created. More advanced call features like programmatic call control, creating conference calls and call queues, call recordings, and conversational IVRs are at your fingertips with Twilio's Programmable Voice.
You can also use the API to route voice calls with global reach to phones, browsers, SIP domains, and mobile applications.
Info
You can obtain numbers by using the Phone Numbers API
All URLs referenced in the documentation have the following base:
1https://api.twilio.com/2010-04-012
The Twilio REST API is served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported.
Info
You can control your connectivity into Twilio's platform by including your specific edge location in the subdomain. This will allow you to bring Twilio's public or private network connectivity closer to your applications for improved performance.
For instance, customers with infrastructure in Australia can make use of the sydney
edge location by using the base URL of:
https://api.sydney.us1.twilio.com/2010-04-01
To authenticate requests to the Twilio APIs, Twilio supports HTTP Basic authentication. Use your API key as the username and your API key's secret as the password. You can create an API key either in the Twilio Console or using the API.
Note: Twilio doesn't recommend using your Account SID and Auth Token in production. For local testing, you can use your Account SID as the username and your Auth token as the password. You can find your Account SID and Auth Token in the Twilio Console.
Learn more about Twilio API authentication.
1curl -G https://api.twilio.com/2010-04-01/Accounts \2-u $TWILIO_API_KEY:$TWILIO_API_KEY_SECRET
Twilio's Voice API lets you make and manage calls programmatically.
Info
To make an outbound call with the API, POST
to the Call resource.
You can also leverage the REST API to query metadata and manage state for:
Make, receive, or manage calls from any web interface or mobile application.
For step-by-step instructions on how to do this with one of our supported helper libraries or SDKs, check out the quickstarts for:
- C#/.NET
- Java
- Node.js
- PHP
- Python
- Ruby
- iOS - Swift
- iOS - Objective-C
- Android
- Voice JavaScript SDK (using Twilio Functions)
The basics of most call flows start with the ability to say strings of text and gather DTMF keypad input.
You can use the Voice API directly to create outbound calls and query and manage state for conferences, queues, and recordings.
Twilio's markup language, TwiML, is the primary language used to control actions on Twilio. For instance, you'll need to use TwiML's <Say> to read some text to a person on a Twilio call.
Twilio provides helper libraries in 6 supported web programming languages: C#/.NET, Java, Node.js, PHP, Python, and Ruby. These helper libraries make including TwiML in your web application a seamless process.
For instance, you can use one of our helper libraries to read some text to a caller and gather their input via keypad: select your language of choice to get started.
Twilio's TwiML provides intelligent Conference and Queue primitives to take the heavy lifting out of building seamless call experiences:
- Create a Conference by leveraging TwiML's <Dial> with <Conference>. When you add a caller to a conference this way, Twilio creates a Conference instance resource and a Participant instance resource to represent the caller who joined.
- Use the Conference resource to list the conferences in your account, update a conference's status, and query information about participants in a given conference.
- Learn how to create and manage conference calls from your web applications using Twilio's helper libraries.
- You can create a new Queue by sending a
POST
request to the Queue resource or by leveraging the <Enqueue> verb in your TwiML document. Learn how to use Twilio's Queue feature to create a call queueing system.
With Twilio's Voice API, you can record, store, and transcribe calls with a little bit of code:
- If you're using the REST API to create your call, set
Record=true
. - You can also generate a recording with TwiML or by doing a
POST
to the Recording List Resource of a Live Call. - Learn how to record calls made from your web application, by taking a spin through thistutorial on recording outgoing and inbound calls with the server-side helper libraries.
- Review our support article for options to transcribe your call recording.
Route calls from your existing VoIP infrastructure to Twilio for programmatic call control - without migrating hardware or carriers with SIP interface.
Programmable Voice SIP lets you route your voice calls with global reach to any landline phone, mobile phone, browser, mobile app, or any other SIP endpoint.
Explore the power of Twilio's Voice API with our quickstarts, see how to make calls or respond to incoming calls, modify calls, and more by diving into our collection of tutorials for Programmable Voice.
Twilio's Voice API is a flexible building block that can take you from making your first phone call.
While we hope this page gives a good overview of what you can do with the API, we're only scratching the surface: check out our troubleshooting tips to learn about Twilio's debugging tools, common issues, and other tools and add-ons like Voice Insights.
If you need any help integrating the Programmable Voice API or want to talk best practices, get in touch. You can give us feedback by using the rating widget on this page, talking to support, talking to sales, or reaching out on Twitter.
Let's build something amazing.