Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Short Code


With Twilio Proxy, you associate phone numbers and short codes (this resource) directly with a Proxy Service. All added numbers go into the Proxy Number Pool associated with a given Proxy Service. For more information on managing the phone numbers in your number pool, refer to our Phone Number Management guide.

(information)

Info

A Twilio short code associated with a Proxy Service cannot be associated with other Proxy Services in the same account.


ShortCode Properties

Property nameTypePIIDescription
sidSID<SC>
Not PII

The unique string that we created to identify the ShortCode resource.

Pattern: ^SC[0-9a-fA-F]{32}$Min length: 34Max length: 34

account_sidSID<AC>

The SID of the Account that created the ShortCode resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

service_sidSID<KS>

The SID of the ShortCode resource's parent Service resource.

Pattern: ^KS[0-9a-fA-F]{32}$Min length: 34Max length: 34

date_updatedstring<date-time>

The ISO 8601 date and time in GMT when the resource was last updated.


short_codestring

The short code's number.


iso_countrystring

The ISO Country Code for the short code.


capabilitiesobject<phone-number-capabilities>

The capabilities of the short code.


urlstring<uri>

The absolute URL of the ShortCode resource.


is_reservedboolean

Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See Reserved Phone Numbers for more information.


Add a Short Code to a Proxy Service

POST https://proxy.twilio.com/v1/Services/{ServiceSid}/ShortCodes

Path parameters

Property nameTypeRequiredPIIDescription
ServiceSidSID<KS>required

The SID of the parent Service resource.

Pattern: ^KS[0-9a-fA-F]{32}$Min length: 34Max length: 34

Request body parameters

Property nameTypeRequiredPIIDescription
SidSID<SC>required

The SID of a Twilio ShortCode resource that represents the short code you would like to assign to your Proxy Service.

Pattern: ^SC[0-9a-fA-F]{32}$Min length: 34Max length: 34

Create a ShortCode

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function createShortCode() {
_18
const shortCode = await client.proxy.v1
_18
.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.shortCodes.create({ sid: "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" });
_18
_18
console.log(shortCode.sid);
_18
}
_18
_18
createShortCode();

Output

_15
{
_15
"sid": "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15
"date_created": "2015-07-30T20:00:00Z",
_15
"date_updated": "2015-07-30T20:00:00Z",
_15
"short_code": "12345",
_15
"iso_country": "US",
_15
"capabilities": {
_15
"sms_outbound": true,
_15
"voice_inbound": false
_15
},
_15
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes/SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15
"is_reserved": false
_15
}


Fetch a ShortCode resource

GET https://proxy.twilio.com/v1/Services/{ServiceSid}/ShortCodes/{Sid}

Path parameters

Property nameTypeRequiredPIIDescription
ServiceSidSID<KS>required

The SID of the parent Service to fetch the resource from.

Pattern: ^KS[0-9a-fA-F]{32}$Min length: 34Max length: 34

SidSID<SC>required

The Twilio-provided string that uniquely identifies the ShortCode resource to fetch.

Pattern: ^SC[0-9a-fA-F]{32}$Min length: 34Max length: 34

Fetch a ShortCode

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function fetchShortCode() {
_19
const shortCode = await client.proxy.v1
_19
.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.shortCodes("SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.fetch();
_19
_19
console.log(shortCode.sid);
_19
}
_19
_19
fetchShortCode();

Output

_15
{
_15
"sid": "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15
"date_created": "2015-07-30T20:00:00Z",
_15
"date_updated": "2015-07-30T20:00:00Z",
_15
"short_code": "12345",
_15
"iso_country": "US",
_15
"capabilities": {
_15
"sms_outbound": true,
_15
"voice_inbound": false
_15
},
_15
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes/SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15
"is_reserved": false
_15
}


Get the list of Short Codes associated with a Proxy Service

GET https://proxy.twilio.com/v1/Services/{ServiceSid}/ShortCodes

Path parameters

Property nameTypeRequiredPIIDescription
ServiceSidSID<KS>required

The SID of the parent Service to read the resources from.

Pattern: ^KS[0-9a-fA-F]{32}$Min length: 34Max length: 34

Query parameters

Property nameTypeRequiredPIIDescription
PageSizeintegerOptional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageintegerOptional

The page index. This value is simply for client state.

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

List multiple ShortCodes

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function listShortCode() {
_18
const shortCodes = await client.proxy.v1
_18
.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.shortCodes.list({ limit: 20 });
_18
_18
shortCodes.forEach((s) => console.log(s.sid));
_18
}
_18
_18
listShortCode();

Output

_28
{
_28
"meta": {
_28
"page": 0,
_28
"page_size": 50,
_28
"first_page_url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes?PageSize=50&Page=0",
_28
"previous_page_url": null,
_28
"next_page_url": null,
_28
"key": "short_codes",
_28
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes?PageSize=50&Page=0"
_28
},
_28
"short_codes": [
_28
{
_28
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"sid": "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"date_created": "2015-07-30T20:00:00Z",
_28
"date_updated": "2015-07-30T20:00:00Z",
_28
"short_code": "12345",
_28
"iso_country": "US",
_28
"capabilities": {
_28
"sms_outbound": true,
_28
"voice_inbound": false
_28
},
_28
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes/SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_28
"is_reserved": false
_28
}
_28
]
_28
}


Update a ShortCode resource

POST https://proxy.twilio.com/v1/Services/{ServiceSid}/ShortCodes/{Sid}

Path parameters

Property nameTypeRequiredPIIDescription
ServiceSidSID<KS>required

The SID of the parent Service of the resource to update.

Pattern: ^KS[0-9a-fA-F]{32}$Min length: 34Max length: 34

SidSID<SC>required

The Twilio-provided string that uniquely identifies the ShortCode resource to update.

Pattern: ^SC[0-9a-fA-F]{32}$Min length: 34Max length: 34

Request body parameters

Property nameTypeRequiredPIIDescription
IsReservedbooleanOptional

Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See Reserved Phone Numbers for more information.

Update a ShortCode

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function updateShortCode() {
_19
const shortCode = await client.proxy.v1
_19
.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.shortCodes("SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_19
.update({ isReserved: true });
_19
_19
console.log(shortCode.sid);
_19
}
_19
_19
updateShortCode();

Output

_15
{
_15
"sid": "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15
"date_created": "2015-07-30T20:00:00Z",
_15
"date_updated": "2015-07-30T20:00:00Z",
_15
"short_code": "12345",
_15
"iso_country": "US",
_15
"capabilities": {
_15
"sms_outbound": true,
_15
"voice_inbound": false
_15
},
_15
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes/SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_15
"is_reserved": true
_15
}


Remove a Short Code from a Proxy Service

DELETE https://proxy.twilio.com/v1/Services/{ServiceSid}/ShortCodes/{Sid}

Path parameters

Property nameTypeRequiredPIIDescription
ServiceSidSID<KS>required

The SID of the parent Service resource to delete the ShortCode resource from.

Pattern: ^KS[0-9a-fA-F]{32}$Min length: 34Max length: 34

SidSID<SC>required

The Twilio-provided string that uniquely identifies the ShortCode resource to delete.

Pattern: ^SC[0-9a-fA-F]{32}$Min length: 34Max length: 34

Delete a ShortCode

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_17
// Download the helper library from https://www.twilio.com/docs/node/install
_17
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_17
_17
// Find your Account SID and Auth Token at twilio.com/console
_17
// and set the environment variables. See http://twil.io/secure
_17
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_17
const authToken = process.env.TWILIO_AUTH_TOKEN;
_17
const client = twilio(accountSid, authToken);
_17
_17
async function deleteShortCode() {
_17
await client.proxy.v1
_17
.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_17
.shortCodes("SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_17
.remove();
_17
}
_17
_17
deleteShortCode();


Rate this page: