Making and Managing Voice Calls with Twilio
Twilio’s Programmable Voice API enables you to make, receive, and control voice calls programmatically.
Endpoint: POST /2010-04-01/Accounts/{AccountSid}/Calls.json
Required Parameters:
To
: The phone number to callFrom
: Your Twilio phone numberUrl
: URL of your TwiML instructions for the callExample request:
curl -X POST https://api.twilio.com/2010-04-01/Accounts/YOUR_ACCOUNT_SID/Calls.json \
--data-urlencode "To=+1XXXXXXXXXX" \
--data-urlencode "From=+1YYYYYYYYYY" \
--data-urlencode "Url=http://demo.twilio.com/docs/voice.xml" \
-u YOUR_ACCOUNT_SID:YOUR_AUTH_TOKEN
Example response:
{
"sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"date_created": "Thu, 30 Jul 2020 20:12:31 +0000",
"date_updated": "Thu, 30 Jul 2020 20:12:31 +0000",
"parent_call_sid": null,
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"to": "+1XXXXXXXXXX",
"to_formatted": "(XXX) XXX-XXXX",
"from": "+1YYYYYYYYYY",
"from_formatted": "(YYY) YYY-YYYY",
"phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"status": "queued",
"start_time": null,
"end_time": null,
"duration": null,
"price": null,
"price_unit": "USD",
"direction": "outbound-api",
"answered_by": null,
"api_version": "2010-04-01",
"forwarded_from": null,
"group_sid": null,
"caller_name": null,
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json"
}