Programmable Voice

With Twilio, you can quickly make and receive voice calls in your application. We provide the docs, code samples, helper libraries, and developer tools you need on your journey. You bring your imagination. Let’s build something amazing together.

Make your first voice call
When your phone number receives an incoming call, Twilio will send an HTTP request to your server at /answer.
1
Twilio servers
Your app tells Twilio how to respond with a text to speech response.
2
Your app
from flask import Flask
from twilio.twiml.voice_response import VoiceResponse
app = Flask(__name__)

@app.route("/answer", methods=['GET', 'POST'])
def answer_call():
    resp = VoiceResponse()
    resp.say("Twilio's always there when you call!")
    return str(resp)

if __name__ == "__main__":
    app.run()
Twilio gets the instructions from your app and sends the voice response.
3
Twilio's always there when you call!
Recipient’s phone

Get Started

With just a few lines of code you’ll make your first outgoing phone call with the Voice API. Add a few more and your app can respond to incoming callers. Choose your programming language to get started.

// These consts are your accountSid and authToken from twilio.com/user/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const Twilio = require('twilio');
const client = new Twilio(accountSid, authToken);

client.api.calls
  .create({
    url: 'http://demo.twilio.com/docs/voice.xml',
    to: '+14155551212',
    from: '+15017122661',
  })
  .then(call => console.log(call.sid));
<?php
require __DIR__ . '/vendor/autoload.php';
use Twilio\Rest\Client;
// Your Account SID and Auth Token from twilio.com/console
$account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$auth_token = 'your_auth_token';
// In production, these should be environment variables. E.g.:
// $auth_token = $_ENV["TWILIO_ACCOUNT_SID"]
// A Twilio number you own with SMS capabilities
$twilio_number = "+15017122661";
// Where to make a voice call (your cell phone?)
$to_number = "+15558675310";
$client = new Client($account_sid, $auth_token);
$client->account->calls->create(  
    $to_number,
    $twilio_number,
    array(
        "url" => "http://demo.twilio.com/docs/voice.xml"
    )
);
from twilio.rest import Client

# Your Account Sid and Auth Token can be found at https://www.twilio.com/console
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

# Start a phone call
call = client.calls.create(
    to="+15558675310",
    from_="+15017122661",
    url="http://demo.twilio.com/docs/voice.xml"
)

print(call.sid)
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# set up a client to talk to the Twilio REST API
@client = Twilio::REST::Client.new account_sid, auth_token

call = @client.calls.create(
    to: "+15558675310",
    from: "+15017122661",
    url: "http://demo.twilio.com/docs/voice.xml")
puts call.to
import java.net.URI;
import java.net.URISyntaxException;

import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Call;
import com.twilio.type.PhoneNumber;

public class MakePhoneCall {
    // Find your Account Sid and Token at twilio.com/console
    public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    public static final String AUTH_TOKEN = "your_auth_token";
    public static void main(String[] args) throws URISyntaxException {
        Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
        String from = "+15017122661";
        String to = "+14155551212";
        Call call = Call.creator(new PhoneNumber(to), new PhoneNumber(from),
                new URI("http://demo.twilio.com/docs/voice.xml")).create();
        System.out.println(call.getSid());
    }
}
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;

namespace YourNewConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
           // Find your Account Sid and Auth Token at twilio.com/console
           const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
           const string authToken = "your_auth_token";
           TwilioClient.Init(accountSid, authToken);

           var to = new PhoneNumber("+14155551212");
           var from = new PhoneNumber("+15017122661");
           var call = CallResource.Create(to, from,
               url: new Uri("http://demo.twilio.com/docs/voice.xml"));
           Console.WriteLine(call.Sid);
        }
    }
}

Ahoy, World!

Make your first call. Jump to a Quickstart in the language of your choice:

Build your App

You’ve got an idea in mind. Let’s get it to production.

Pick the docs that are right for you. These short tutorials, sample apps, and API reference docs will get you from dream to HTTP 200 OK.

Advanced Features

Your application is unique, but you’re not alone – we’ve got the building blocks you need to grow and scale. Use Twilio with your current VoIP system, debug call issues, find the right data, and queue and modify calls. Deploy your app with confidence.


Twilio’s Voice Insights takes your apps to the next level and helps you target the right improvements. Surface jitter, mean opinion score, and latency issues while monitoring the carrier and hang-up data you need to improve your service.

image/svg+xml