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

shortcode-properties page anchor
Resource properties
sidtype: SID<SC>Not PII

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


service_sidtype: SID<KS>Not PII

The SID of the ShortCode resource's parent Service(link takes you to an external page) resource.


date_createdtype: string<DATE TIME>Not PII

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


date_updatedtype: string<DATE TIME>Not PII

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


short_codetype: stringNot PII

The short code's number.


iso_countrytype: stringNot PII

The ISO Country Code for the short code.


capabilitiestype: object<PHONE NUMBER CAPABILITIES>Not PII

The capabilities of the short code.


urltype: string<URI>Not PII

The absolute URL of the ShortCode resource.


is_reservedtype: booleanNot PII

Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See Reserved Phone Numbers(link takes you to an external page) 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

Parameters

create-parameters page anchor
URI parameters
ServiceSidtype: SID<KS>Not PII
Path Parameter

The SID of the parent Service(link takes you to an external page) resource.


Request body parameters
Sidtype: SID<SC>Not PII
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.

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

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.proxy.v1.services('KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.shortCodes
_11
.create({sid: 'SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'})
_11
.then(short_code => console.log(short_code.sid));

Output

_15
{
_15
"sid": "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"service_sid": "KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_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/KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ShortCodes/SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"is_reserved": false
_15
}


Fetch a ShortCode resource

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

URI parameters
ServiceSidtype: SID<KS>Not PII
Path Parameter

The SID of the parent Service(link takes you to an external page) to fetch the resource from.


Sidtype: SID<SC>Not PII
Path Parameter

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

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

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.proxy.v1.services('KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.shortCodes('SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.fetch()
_11
.then(short_code => console.log(short_code.sid));

Output

_15
{
_15
"sid": "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"service_sid": "KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_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/KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ShortCodes/SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"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

URI parameters
ServiceSidtype: SID<KS>Not PII
Path Parameter

The SID of the parent Service(link takes you to an external page) to read the resources from.


PageSizetype: integerNot PII
Query Parameter

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


Pagetype: integerNot PII
Query Parameter

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


PageTokentype: stringNot PII
Query Parameter

The page token. This is provided by the API.

List multiple ShortCodes

list-multiple-shortcodes page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

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

Output

_28
{
_28
"meta": {
_28
"page": 0,
_28
"page_size": 50,
_28
"first_page_url": "https://proxy.twilio.com/v1/Services/KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ShortCodes?PageSize=50&Page=0",
_28
"previous_page_url": "https://proxy.twilio.com/v1/Services/KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ShortCodes?PageSize=50&Page=0",
_28
"next_page_url": "https://proxy.twilio.com/v1/Services/KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ShortCodes?PageSize=50&Page=1",
_28
"key": "short_codes",
_28
"url": "https://proxy.twilio.com/v1/Services/KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ShortCodes?PageSize=50&Page=0"
_28
},
_28
"short_codes": [
_28
{
_28
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_28
"service_sid": "KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_28
"sid": "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_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/KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ShortCodes/SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_28
"is_reserved": false
_28
}
_28
]
_28
}


Update a ShortCode resource

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

URI parameters
ServiceSidtype: SID<KS>Not PII
Path Parameter

The SID of the parent Service(link takes you to an external page) of the resource to update.


Sidtype: SID<SC>Not PII
Path Parameter

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


Request body parameters
IsReservedtype: booleanNot PII

Whether the short code should be reserved and not be assigned to a participant using proxy pool logic. See Reserved Phone Numbers(link takes you to an external page) for more information.

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

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.proxy.v1.services('KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.shortCodes('SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.update({isReserved: true})
_11
.then(short_code => console.log(short_code.sid));

Output

_15
{
_15
"sid": "SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"service_sid": "KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_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/KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ShortCodes/SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_15
"is_reserved": true
_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}

URI parameters
ServiceSidtype: SID<KS>Not PII
Path Parameter

The SID of the parent Service(link takes you to an external page) resource to delete the ShortCode resource from.


Sidtype: SID<SC>Not PII
Path Parameter

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

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

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.proxy.v1.services('KSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.shortCodes('SCXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.remove();


Rate this page: