Skip to contentSkip to navigationSkip to topbar
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

shortcode-properties page anchor
Property nameTypeRequiredDescriptionChild properties
sidSID<SC>Optional
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>Optional

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>Optional

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>Optional

The ISO 8601(link takes you to an external page) date and time in GMT when the resource was last updated.


short_codestringOptional

The short code's number.


iso_countrystringOptional

The ISO Country Code for the short code.


capabilitiesobject<phone-number-capabilities>Optional

The capabilities of the short code.


urlstring<uri>Optional

The absolute URL of the ShortCode resource.


is_reservedbooleanOptional

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

add-a-short-code-to-a-proxy-service page anchor
POST https://proxy.twilio.com/v1/Services/{ServiceSid}/ShortCodes

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
ServiceSidSID<KS>required

The SID of the parent Service resource.

Pattern: ^KS[0-9a-fA-F]{32}$Min length: 34Max length: 34
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
SidSID<SC>required

The SID of a Twilio ShortCode(link takes you to an external page) 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 ShortCodeLink to code sample: Create a ShortCode
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function createShortCode() {
11
const shortCode = await client.proxy.v1
12
.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.shortCodes.create({ sid: "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" });
14
15
console.log(shortCode.sid);
16
}
17
18
createShortCode();

Output

1
{
2
"sid": "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
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
"short_code": "12345",
8
"iso_country": "US",
9
"capabilities": {
10
"sms_outbound": true,
11
"voice_inbound": false
12
},
13
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes/SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
14
"is_reserved": false
15
}

Fetch a ShortCode resource

fetch-a-shortcode-resource page anchor
GET https://proxy.twilio.com/v1/Services/{ServiceSid}/ShortCodes/{Sid}

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
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchShortCode() {
11
const shortCode = await client.proxy.v1
12
.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.shortCodes("SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.fetch();
15
16
console.log(shortCode.sid);
17
}
18
19
fetchShortCode();

Output

1
{
2
"sid": "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
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
"short_code": "12345",
8
"iso_country": "US",
9
"capabilities": {
10
"sms_outbound": true,
11
"voice_inbound": false
12
},
13
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes/SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
14
"is_reserved": false
15
}

Get the list of Short Codes associated with a Proxy Service

get-the-list-of-short-codes-associated-with-a-proxy-service page anchor
GET https://proxy.twilio.com/v1/Services/{ServiceSid}/ShortCodes

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
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.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listShortCode() {
11
const shortCodes = await client.proxy.v1
12
.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.shortCodes.list({ limit: 20 });
14
15
shortCodes.forEach((s) => console.log(s.sid));
16
}
17
18
listShortCode();

Output

1
{
2
"meta": {
3
"page": 0,
4
"page_size": 50,
5
"first_page_url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes?PageSize=50&Page=0",
6
"previous_page_url": null,
7
"next_page_url": null,
8
"key": "short_codes",
9
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes?PageSize=50&Page=0"
10
},
11
"short_codes": [
12
{
13
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
14
"service_sid": "KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
15
"sid": "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
16
"date_created": "2015-07-30T20:00:00Z",
17
"date_updated": "2015-07-30T20:00:00Z",
18
"short_code": "12345",
19
"iso_country": "US",
20
"capabilities": {
21
"sms_outbound": true,
22
"voice_inbound": false
23
},
24
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes/SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
25
"is_reserved": false
26
}
27
]
28
}

Update a ShortCode resource

update-a-shortcode-resource page anchor
POST https://proxy.twilio.com/v1/Services/{ServiceSid}/ShortCodes/{Sid}

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
Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
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.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function updateShortCode() {
11
const shortCode = await client.proxy.v1
12
.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.shortCodes("SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.update({ isReserved: false });
15
16
console.log(shortCode.sid);
17
}
18
19
updateShortCode();

Output

1
{
2
"sid": "SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
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
"short_code": "12345",
8
"iso_country": "US",
9
"capabilities": {
10
"sms_outbound": true,
11
"voice_inbound": false
12
},
13
"url": "https://proxy.twilio.com/v1/Services/KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/ShortCodes/SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
14
"is_reserved": false
15
}

Remove a Short Code from a Proxy Service

remove-a-short-code-from-a-proxy-service page anchor
DELETE https://proxy.twilio.com/v1/Services/{ServiceSid}/ShortCodes/{Sid}

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
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function deleteShortCode() {
11
await client.proxy.v1
12
.services("KSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
13
.shortCodes("SCaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
14
.remove();
15
}
16
17
deleteShortCode();