Get Started

REST API: Short Codes

A short code is a 5 or 6-digit number that can send and receive messages with mobile phones. These high-throughput numbers are perfect for apps that need to send messages to lots of users or need to send time sensitive messages. You can buy shortcodes from Twilio or port existing short codes to our platform.

To send messages from your short code, see the Sending Messages documentation.

ShortCode Instance Resource

Resource URI

/2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes/{ShortCodeSid}

Resource Properties

Property Description
Sid A 34 character string that uniquely identifies this resource.
DateCreated The date that this resource was created, given as GMT RFC 2822 format.
DateUpdated The date that this resource was last updated, given as GMT RFC 2822 format.
FriendlyName A human readable descriptive text for this resource, up to 64 characters long. By default, the FriendlyName is just the short code.
AccountSid The unique id of the Account that owns this short code.
ShortCode The short code. e.g., 894546.
ApiVersion SMSs to this short code will start a new TwiML session with this API version.
SmsUrl The URL Twilio will request when receiving an incoming SMS message to this short code.
SmsMethod The HTTP method Twilio will use when making requests to the SmsUrl. Either GET or POST.
SmsFallbackUrl The URL that Twilio will request if an error occurs retrieving or executing the TwiML from SmsUrl.
SmsFallbackMethod The HTTP method Twilio will use when requesting the above URL. Either GET or POST.
Uri The URI for this resource, relative to https://api.twilio.com.

HTTP GET

Example

HTTP POST

Tries to update the shortcode's properties, and returns the updated resource representation if successful. The returned response is identical to that returned above when making a GET request.

Optional Parameters

You may specify one or more of the following parameters to update this short code's respective properties:

Parameter Description
FriendlyName A human readable description of the short code, with maximum length 64 characters.
ApiVersion SMSs to this short code will start a new TwiML session with this API version. Either 2010-04-01 or 2008-08-01.
SmsUrl The URL that Twilio should request when somebody sends an SMS to the short code.
SmsMethod The HTTP method that should be used to request the SmsUrl. Either GET or POST.
SmsFallbackUrl A URL that Twilio will request if an error occurs requesting or executing the TwiML at the SmsUrl.
SmsFallbackMethod The HTTP method that should be used to request the SmsFallbackUrl. Either GET or POST.
Example 1

Set the SmsUrl on a short code to 'http://myapp.com/awesome'

HTTP PUT

Not supported.

HTTP DELETE

Not supported.

ShortCodes List Resource

Resource URI

/2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes

HTTP GET

Returns a list of ShortCode resource representations, each representing a short code within your account. The list includes paging information.

List Filters

The following query string parameters allow you to limit the list returned. Note, parameters are case-sensitive:

Parameter Description
ShortCode Only show the ShortCode resources that match this pattern. You can specify partial numbers and use '*' as a wildcard for any digit.
FriendlyName Only show the ShortCode resources with friendly names that exactly match this name.
Example 1
Example 2

Return the set of short codes that match exactly 67898.

Example 3

Return the set of all phone numbers containing the digits 898.

HTTP POST

Not supported.

HTTP PUT

Not supported.

HTTP DELETE

Not supported.