Twilio provides you with a set of test credentials so you can exercise parts of the REST API without charging your account. You can find your credentials in the Auth Tokens page of your Console.
You use these credentials in the same way as your live credentials, with one restriction being that you cannot log in to the Twilio CLI with your test credentials. However, when you authenticate with your test credentials, we will not charge your account, update the state of your account, or connect to real phone numbers. You can now pretend to buy a phone number or send an SMS, without actually doing so.
To protect your production data, your test credentials can't interact with the data in your real account. For example, you can't use phone numbers from your real account as the 'From' number in requests made with your test credentials.
Your test credentials can currently be used to interact with the following three resources:
POST /2010-04-01/Accounts/{TestAccountSid}/IncomingPhoneNumbers
POST /2010-04-01/Accounts/{TestAccountSid}/Messages
POST /2010-04-01/Accounts/{TestAccountSid}/Calls
Requests to any other resource with test credentials will receive a 403 Forbidden
response. In the future, we may enable these resources for testing
as well.
A limitation of SMS messages and calls made using test credentials is that they will not trigger status callbacks. Learn more about status callbacks for outbound SMS and status callbacks for Voice.
When you make an API request with your test credentials, Twilio will validate all input as though the request were made with your real credentials. However, there are some cases when a request's validity depends on the state of Twilio. For instance, if you are trying to buy a phone number and that phone number is no longer available, Twilio will return an error.
To write test cases that expect and handle errors which depend on
the state of Twilio, we provide magic inputs. For the case mentioned above,
there is a magic phone number +15005550000
which if you pass it as the
'PhoneNumber' parameter in a POST
to IncomingPhoneNumbers, will always return
an error saying the number is unavailable.
The full set of magic inputs is detailed below.
If you'd like to test API requests to the phone numbers resource without provisioning a number for your account, you can use your test credentials.
You use these credentials in the same way as your live credentials. However, when you authenticate with your test credentials, we will not charge your account or purchase a phone number for you. This way, you can pretend to buy a phone number without actually doing so.
Just POST
to the normal phone number purchase API endpoint using your test
credentials to authenticate and your TestAccountSid in the URL:
1POST https://api.twilio.com/2010-04-01/Accounts/{TestAccountSid}/IncomingPhoneNumbers2
All of the existing phone number purchase parameters will work. In addition, we provide some specific values for certain parameters to help you generate success and failure cases.
Value | Description | Error Code |
---|---|---|
533 | This area code doesn't have any available phone numbers. | 21452 |
500 | This area code has an available number. | No error |
Successfully provision a number. Purchase will always be completed successfully if
you attempt to purchase the magic number +15005550006
. Any other parameters
you send with the request, such as a VoiceUrl
or a StatusCallback
, will be
included in the API response.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createIncomingPhoneNumber() {11const incomingPhoneNumber = await client.incomingPhoneNumbers.create({12phoneNumber: "+15005550006",13voiceUrl: "http://demo.twilio.com/docs/voice.xml",14});1516console.log(incomingPhoneNumber.accountSid);17}1819createIncomingPhoneNumber();
1{2"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"address_requirements": "none",4"address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"api_version": "2010-04-01",6"beta": false,7"capabilities": {8"voice": true,9"sms": false,10"mms": true,11"fax": false12},13"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",14"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",15"emergency_status": "Active",16"emergency_address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"emergency_address_status": "registered",18"friendly_name": "friendly_name",19"identity_sid": "RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",20"origin": "origin",21"phone_number": "+15005550006",22"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",23"sms_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",24"sms_fallback_method": "GET",25"sms_fallback_url": "https://example.com",26"sms_method": "GET",27"sms_url": "https://example.com",28"status_callback": "https://example.com",29"status_callback_method": "GET",30"trunk_sid": null,31"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",32"voice_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",33"voice_caller_id_lookup": false,34"voice_fallback_method": "GET",35"voice_fallback_url": "https://example.com",36"voice_method": "GET",37"voice_url": "http://demo.twilio.com/docs/voice.xml",38"bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",39"voice_receive_mode": "voice",40"status": "in-use",41"subresource_uris": {42"assigned_add_ons": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AssignedAddOns.json"43}44}
Attempt to purchase an unavailable number. Trigger this by passing the magic
number +15005550000
.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createIncomingPhoneNumber() {11const incomingPhoneNumber = await client.incomingPhoneNumbers.create({12phoneNumber: "+15005550000",13});1415console.log(incomingPhoneNumber.accountSid);16}1718createIncomingPhoneNumber();
1{2"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"address_requirements": "none",4"address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"api_version": "2010-04-01",6"beta": false,7"capabilities": {8"voice": true,9"sms": false,10"mms": true,11"fax": false12},13"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",14"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",15"emergency_status": "Active",16"emergency_address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"emergency_address_status": "registered",18"friendly_name": "friendly_name",19"identity_sid": "RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",20"origin": "origin",21"phone_number": "+15005550000",22"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",23"sms_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",24"sms_fallback_method": "GET",25"sms_fallback_url": "https://example.com",26"sms_method": "GET",27"sms_url": "https://example.com",28"status_callback": "https://example.com",29"status_callback_method": "GET",30"trunk_sid": null,31"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",32"voice_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",33"voice_caller_id_lookup": false,34"voice_fallback_method": "GET",35"voice_fallback_url": "https://example.com",36"voice_method": "GET",37"voice_url": "https://example.com",38"bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",39"voice_receive_mode": "voice",40"status": "in-use",41"subresource_uris": {42"assigned_add_ons": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AssignedAddOns.json"43}44}
Just specify an invalid number as your input. Twilio will try to convert letters to numbers, but specifying a very short or very long string of either will fail.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createIncomingPhoneNumber() {11const incomingPhoneNumber = await client.incomingPhoneNumbers.create({12phoneNumber: "33",13});1415console.log(incomingPhoneNumber.accountSid);16}1718createIncomingPhoneNumber();
1{2"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"address_requirements": "none",4"address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"api_version": "2010-04-01",6"beta": false,7"capabilities": {8"voice": true,9"sms": false,10"mms": true,11"fax": false12},13"date_created": "Thu, 30 Jul 2015 23:19:04 +0000",14"date_updated": "Thu, 30 Jul 2015 23:19:04 +0000",15"emergency_status": "Active",16"emergency_address_sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"emergency_address_status": "registered",18"friendly_name": "friendly_name",19"identity_sid": "RIaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",20"origin": "origin",21"phone_number": "33",22"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",23"sms_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",24"sms_fallback_method": "GET",25"sms_fallback_url": "https://example.com",26"sms_method": "GET",27"sms_url": "https://example.com",28"status_callback": "https://example.com",29"status_callback_method": "GET",30"trunk_sid": null,31"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",32"voice_application_sid": "APaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",33"voice_caller_id_lookup": false,34"voice_fallback_method": "GET",35"voice_fallback_url": "https://example.com",36"voice_method": "GET",37"voice_url": "https://example.com",38"bundle_sid": "BUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",39"voice_receive_mode": "voice",40"status": "in-use",41"subresource_uris": {42"assigned_add_ons": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/AssignedAddOns.json"43}44}
If you'd like to test API requests to send SMS messages without charging your account or sending an SMS, you can use your test credentials.
Just POST
to the normal SMS API endpoint using your test
credentials to authenticate and your TestAccountSid in the URL:
1POST https://api.twilio.com/2010-04-01/Accounts/{TestAccountSid}/Messages2
All of the existing outbound SMS
parameters will work, except for MessagingServiceSid
. In addition,
we provide some specific values for certain parameters to help you generate
success and failure cases.
Your test credentials don't have access to any valid 'From' phone numbers on your real account. Therefore, the only phone numbers you should use as 'From' numbers are the magic numbers listed here.
Value | Description | Error Code |
---|---|---|
+15005550001 | This phone number is invalid. | 21212 |
+15005550007 | This phone number is not owned by your account or is not SMS-capable. | 21606 |
+15005550008 | This number has an SMS message queue that is full. | 21611 |
+15005550006 | This number passes all validation. | No error |
All Others | This phone number is not owned by your account or is not SMS-capable. | 21606 |
Value | Description | Error Code |
---|---|---|
+15005550001 | This phone number is invalid. | 21211 |
+15005550002 | Twilio cannot route to this number. | 21612 |
+15005550003 | Your account doesn't have the international permissions necessary to SMS this number. | 21408 |
+15005550004 | This number is blocked for your account. | 21610 |
+15005550009 | This number is incapable of receiving SMS messages. | 21614 |
All Others | Any other phone number is validated normally. | Input-dependent |
Successfully send an SMS. Trigger this by sending an SMS using the magic number
+15005550006
as the From
number, and a regular phone number for the To
number.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createMessage() {11const message = await client.messages.create({12body: "All in the game, yo",13from: "+15005550006",14to: "+5571981265131",15});1617console.log(message.body);18}1920createMessage();
1{2"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"api_version": "2010-04-01",4"body": "All in the game, yo",5"date_created": "Thu, 30 Jul 2015 20:12:31 +0000",6"date_sent": "Thu, 30 Jul 2015 20:12:33 +0000",7"date_updated": "Thu, 30 Jul 2015 20:12:33 +0000",8"direction": "outbound-api",9"error_code": null,10"error_message": null,11"from": "+15005550006",12"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13"num_media": "0",14"num_segments": "1",15"price": null,16"price_unit": null,17"sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"status": "queued",19"subresource_uris": {20"media": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media.json"21},22"tags": null,23"to": "+5571981265131",24"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"25}
Attempt to send a message to a non-mobile number. Trigger this by passing the
magic number +15005550009
as the To
number.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createMessage() {11const message = await client.messages.create({12body: "Hey Mr Nugget, you the bomb!",13from: "+15005550006",14to: "+15005550009",15});1617console.log(message.body);18}1920createMessage();
1{2"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"api_version": "2010-04-01",4"body": "Hey Mr Nugget, you the bomb!",5"date_created": "Thu, 24 Aug 2023 05:01:45 +0000",6"date_sent": "Thu, 24 Aug 2023 05:01:45 +0000",7"date_updated": "Thu, 24 Aug 2023 05:01:45 +0000",8"direction": "outbound-api",9"error_code": null,10"error_message": null,11"from": "+15005550006",12"num_media": "0",13"num_segments": "1",14"price": null,15"price_unit": null,16"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"status": "queued",19"subresource_uris": {20"media": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media.json"21},22"tags": {23"campaign_name": "Spring Sale 2022",24"message_type": "cart_abandoned"25},26"to": "+15005550009",27"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"28}
Attempt to send a message with an empty SMS body. No need for magic numbers, the validation error will be raised normally.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createMessage() {11const message = await client.messages.create({12body: "Do. Or do not. There is no try.",13from: "+15005550006",14to: "+14108675310",15});1617console.log(message.body);18}1920createMessage();
1{2"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"api_version": "2010-04-01",4"body": "Do. Or do not. There is no try.",5"date_created": "Thu, 24 Aug 2023 05:01:45 +0000",6"date_sent": "Thu, 24 Aug 2023 05:01:45 +0000",7"date_updated": "Thu, 24 Aug 2023 05:01:45 +0000",8"direction": "outbound-api",9"error_code": null,10"error_message": null,11"from": "+15005550006",12"num_media": "0",13"num_segments": "1",14"price": null,15"price_unit": null,16"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"status": "queued",19"subresource_uris": {20"media": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media.json"21},22"tags": {23"campaign_name": "Spring Sale 2022",24"message_type": "cart_abandoned"25},26"to": "+14108675310",27"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"28}
If you'd like to test API requests to the outbound call endpoint without charging your account or making a call, you can use your test credentials. Note that since no call is made, Twilio will not request the URL passed in the 'Url' parameter and no TwiML will be executed.
Just POST
to the normal outbound call API endpoint using your test
credentials to authenticate and your TestAccountSid in the URL:
1POST https://api.twilio.com/2010-04-01/Accounts/{TestAccountSid}/Calls2
All of the existing outbound call parameters will work. In addition, we provide some specific values for certain parameters to help you generate success and failure cases.
Your test credentials don't have access to any valid 'From' phone numbers on your real account. Therefore the only phone number you should use as a 'From' number is the magic number listed here.
Value | Description | Error Code |
---|---|---|
+15005550001 | This phone number is invalid. | 21217 |
+15005550002 | Twilio cannot route to this number. | 21214 |
+15005550003 | Your account doesn't have the international permissions necessary to call this number. | 21215 |
+15005550004 | This number is blocked for your account. | 21216 |
All Others | Any other phone number is validated normally. | Input-dependent |
Successfully enqueue an outgoing call. Use the magic number +15005550006
as
the From
number and any regular number as the To
number.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createCall() {11const call = await client.calls.create({12from: "+15005550006",13to: "+14108675310",14url: "http://demo.twilio.com/docs/voice.xml",15});1617console.log(call.sid);18}1920createCall();
1{2"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"annotation": null,4"answered_by": null,5"api_version": "2010-04-01",6"caller_name": null,7"date_created": "Tue, 31 Aug 2010 20:36:28 +0000",8"date_updated": "Tue, 31 Aug 2010 20:36:44 +0000",9"direction": "inbound",10"duration": "15",11"end_time": "Tue, 31 Aug 2010 20:36:44 +0000",12"forwarded_from": "+141586753093",13"from": "+15005550006",14"from_formatted": "(415) 867-5308",15"group_sid": null,16"parent_call_sid": null,17"phone_number_sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"price": "-0.03000",19"price_unit": "USD",20"sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",21"start_time": "Tue, 31 Aug 2010 20:36:29 +0000",22"status": "completed",23"subresource_uris": {24"notifications": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications.json",25"recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings.json",26"payments": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Payments.json",27"events": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events.json",28"siprec": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Siprec.json",29"streams": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams.json",30"transcriptions": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Transcriptions.json",31"user_defined_message_subscriptions": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/UserDefinedMessageSubscriptions.json",32"user_defined_messages": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/UserDefinedMessages.json"33},34"to": "+14108675310",35"to_formatted": "(415) 867-5309",36"trunk_sid": null,37"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",38"queue_time": "1000"39}
Attempt to call an international number in a country without permission turned
on. Trigger this by passing the magic number +15005550003
as the To
number.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createCall() {11const call = await client.calls.create({12from: "+15005550006",13to: "+15005550003",14url: "http://demo.twilio.com/docs/voice.xml",15});1617console.log(call.sid);18}1920createCall();
1{2"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"annotation": null,4"answered_by": null,5"api_version": "2010-04-01",6"caller_name": null,7"date_created": "Tue, 31 Aug 2010 20:36:28 +0000",8"date_updated": "Tue, 31 Aug 2010 20:36:44 +0000",9"direction": "inbound",10"duration": "15",11"end_time": "Tue, 31 Aug 2010 20:36:44 +0000",12"forwarded_from": "+141586753093",13"from": "+15005550006",14"from_formatted": "(415) 867-5308",15"group_sid": null,16"parent_call_sid": null,17"phone_number_sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"price": "-0.03000",19"price_unit": "USD",20"sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",21"start_time": "Tue, 31 Aug 2010 20:36:29 +0000",22"status": "completed",23"subresource_uris": {24"notifications": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Notifications.json",25"recordings": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Recordings.json",26"payments": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Payments.json",27"events": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Events.json",28"siprec": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Siprec.json",29"streams": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Streams.json",30"transcriptions": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Transcriptions.json",31"user_defined_message_subscriptions": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/UserDefinedMessageSubscriptions.json",32"user_defined_messages": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/UserDefinedMessages.json"33},34"to": "+15005550003",35"to_formatted": "(415) 867-5309",36"trunk_sid": null,37"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Calls/CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",38"queue_time": "1000"39}