Proxy Public Beta is currently closed for new customers. Please consider using Twilio Conversations and Programmable Voice directly if you are building your masking application.
Note that this does not have any impact on Twilio Flex customers.
Twilio's Proxy API is currently available as a Public Beta product. Some features are not yet implemented and others may be changed before the product is declared as Generally Available.
Public Beta products are not covered by a Twilio SLA.
With Twilio Proxy, you associate phone numbers (this resource) directly with a Proxy Service. All added numbers go into the Phone Number Pool associated with a given Proxy Service.
A Twilio number cannot be associated with more than one Proxy Service, but it can be associated with a Messaging Service, for example, to complete US A2P 10DLC registration (see below for important details about how to do this).
For more information on managing the phone numbers in your Proxy Phone Number Pool, refer to our Phone Number Management guide.
In a Proxy service, phone numbers can be marked as Reserved. Reserved numbers will not be included in the set of numbers Proxy considers when choosing a number for a participant, but they can be manually assigned as Proxy Numbers for participants (e.g., in a lead tracking use-case).
Phone Number Pools are limited to 5000 reserved phone numbers and 500 unreserved phone numbers per Proxy Service. Numbers can be distributed across multiple Proxy Services if you need more of numbers.
It is possible to associate Twilio Proxy numbers with a Messaging Service, although there are some limitations to be aware of. This capability is especially important for customers who use US long code numbers to send messages to US recipients because adding numbers to a Messaging Service is required in order to complete A2P 10DLC registration.
Currently, a number that is already associated with a Messaging Service cannot be added to a Proxy Service via the Proxy Console or API.
However, Twilio numbers that are already associated with a Proxy Service can be associated with a Messaging Service. Before doing this, you must ensure that your Messaging Service is configured correctly. Your Messaging Service must have its Incoming Message handling behavior set to "Defer to sender's webhook" to ensure that your numbers continue to use Proxy after they are added to the Service.
Step-by-step instructions to associate Proxy numbers with a Messaging Service:
The unique string that we created to identify the PhoneNumber resource.
^PN[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Account that created the PhoneNumber resource.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the PhoneNumber resource's parent Service resource.
^KS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The ISO 8601 date and time in GMT when the resource was created.
The ISO 8601 date and time in GMT when the resource was last updated.
The phone number in E.164 format, which consists of a + followed by the country code and subscriber number.
The capabilities of the phone number.
Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See Reserved Phone Numbers for more information.
The number of open session assigned to the number. See the How many Phone Numbers do I need? guide for more information.
0
POST https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers
application/x-www-form-urlencoded
The SID of a Twilio IncomingPhoneNumber resource that represents the Twilio Number you would like to assign to your Proxy Service.
^PN[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The phone number in E.164 format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234.
Whether the new phone number should be reserved and not be assigned to a participant using proxy pool logic. See Reserved Phone Numbers for more information.
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 createPhoneNumber() {11const phoneNumber = await client.proxy.v112.services("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")13.phoneNumbers.create({ sid: "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" });1415console.log(phoneNumber.sid);16}1718createPhoneNumber();
1{2"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"service_sid": "KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",5"date_created": "2015-07-30T20:00:00Z",6"date_updated": "2015-07-30T20:00:00Z",7"phone_number": "+1987654321",8"friendly_name": "Friendly Name",9"iso_country": "US",10"capabilities": {11"sms_outbound": true,12"voice_inbound": false13},14"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"is_reserved": false,16"in_use": 017}
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 createPhoneNumber() {11const phoneNumber = await client.proxy.v112.services("KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")13.phoneNumbers.create({14isReserved: true,15sid: "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",16});1718console.log(phoneNumber.sid);19}2021createPhoneNumber();
1{2"sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"service_sid": "KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",5"date_created": "2015-07-30T20:00:00Z",6"date_updated": "2015-07-30T20:00:00Z",7"phone_number": "+1987654321",8"friendly_name": "Friendly Name",9"iso_country": "US",10"capabilities": {11"sms_outbound": true,12"voice_inbound": false13},14"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"is_reserved": true,16"in_use": 017}
Note: You should pass a PhoneNumber
or a Sid
(identifying a phone number on your account). Only one of them is required. Passing both will return an error.
GET https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}
The SID of the parent Service of the PhoneNumber resource to fetch.
^KS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The Twilio-provided string that uniquely identifies the PhoneNumber resource to fetch.
^PN[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
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 fetchPhoneNumber() {11const phoneNumber = await client.proxy.v112.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.phoneNumbers("PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.fetch();1516console.log(phoneNumber.sid);17}1819fetchPhoneNumber();
1{2"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"date_created": "2015-07-30T20:00:00Z",6"date_updated": "2015-07-30T20:00:00Z",7"phone_number": "12345",8"friendly_name": "Friendly Name",9"iso_country": "US",10"capabilities": {11"sms_outbound": true,12"voice_inbound": false13},14"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"is_reserved": false,16"in_use": 017}
GET https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1
Maximum: 1000
The page token. This is provided by the API.
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 listPhoneNumber() {11const phoneNumbers = await client.proxy.v112.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.phoneNumbers.list({ limit: 20 });1415phoneNumbers.forEach((p) => console.log(p.sid));16}1718listPhoneNumber();
1{2"meta": {3"page": 0,4"page_size": 50,5"first_page_url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers?PageSize=50&Page=0",6"previous_page_url": null,7"next_page_url": null,8"key": "phone_numbers",9"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers?PageSize=50&Page=0"10},11"phone_numbers": [12{13"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",16"date_created": "2015-07-30T20:00:00Z",17"date_updated": "2015-07-30T20:00:00Z",18"phone_number": "+1987654321",19"friendly_name": "Friendly Name",20"iso_country": "US",21"capabilities": {22"sms_outbound": true,23"voice_inbound": false24},25"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",26"is_reserved": false,27"in_use": 028}29]30}
POST https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}
The SID of the parent Service of the PhoneNumber resource to update.
^KS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The Twilio-provided string that uniquely identifies the PhoneNumber resource to update.
^PN[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
application/x-www-form-urlencoded
Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See Reserved Phone Numbers for more information.
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 updatePhoneNumber() {11const phoneNumber = await client.proxy.v112.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.phoneNumbers("PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.update({ isReserved: false });1516console.log(phoneNumber.sid);17}1819updatePhoneNumber();
1{2"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"date_created": "2015-07-30T20:00:00Z",6"date_updated": "2015-07-30T20:00:00Z",7"phone_number": "12345",8"friendly_name": "Friendly Name",9"iso_country": "US",10"capabilities": {11"sms_outbound": true,12"voice_inbound": false13},14"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"is_reserved": false,16"in_use": 017}
DELETE https://proxy.twilio.com/v1/Services/{ServiceSid}/PhoneNumbers/{Sid}
The SID of the parent Service of the PhoneNumber resource to delete.
^KS[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The Twilio-provided string that uniquely identifies the PhoneNumber resource to delete.
^PN[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
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 deletePhoneNumber() {11await client.proxy.v112.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.phoneNumbers("PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")14.remove();15}1617deletePhoneNumber();