Menu

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Messaging 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 properties

account_sid
sid<AC> Not PII

The unique id of the Account that owns this short code.

api_version
string Not PII

SMSs to this short code will start a new TwiML session with this API version.

date_created
date_time<rfc2822> Not PII

The date that this resource was created, given as GMT RFC 2822 format.

date_updated
date_time<rfc2822> Not PII

The date that this resource was last updated, given as GMT RFC 2822 format.

friendly_name
string Not PII

A human readable descriptive text for this resource, up to 64 characters long. By default, the FriendlyName is just the short code.

short_code
string Not PII

The short code. e.g., 894546.

sid
sid<SC> Not PII

A 34 character string that uniquely identifies this resource.

sms_fallback_method
http_method Not PII

The HTTP method Twilio will use when requesting the above URL. Either GET or POST.

sms_fallback_url
url Not PII

The URL that Twilio will request if an error occurs retrieving or executing the TwiML from SmsUrl.

sms_method
http_method Not PII

The HTTP method Twilio will use when making requests to the SmsUrl. Either GET or POST.

sms_url
url Not PII

The URL Twilio will request when receiving an incoming SMS message to this short code.

uri
uri Not PII

The URI for this resource, relative to https://api.twilio.com.

Fetch a ShortCode resource

get
https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes/{Sid}.json
Parameters
Sid
Required
get sid<SC> Not PII

The short-code Sid that uniquely identifies this resource

Example
Loading Code Sample...
      
      
      
      

      Read multiple ShortCode resources

      get
      https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes.json

      Returns a list of ShortCode resources, each representing a short code within your account. This list includes paging information.

      Filter the list Twilio returns

      The following query string parameters allow you to limit the list returned.

      Parameters
      FriendlyName
      Optional
      get string Not PII

      Only show the ShortCode resources with friendly names that exactly match this name.

      ShortCode
      Optional
      get string Not PII

      Only show the ShortCode resources that match this pattern. You can specify partial numbers and use '*' as a wildcard for any digit.

      Example 1
      Loading Code Sample...
          
          
          
          
          Example 2
          Loading Code Sample...
              
              
              
              
              Return the set of short codes that match '67898'

              Read: list Short Codes with an exact match

              Return the set of short codes that match '67898'
              Example 3
              Loading Code Sample...
                  
                  
                  
                  
                  Return the set of all phone numbers containing the digits '898'

                  Read: list all Short Codes with a partial match

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

                  Update a ShortCode resource

                  post
                  https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/SMS/ShortCodes/{Sid}.json

                  Tries to update the shortcode's properties. This API call returns the updated resource representation if it is successful. The returned response is identical to that returned when making a GET request.

                  Parameters
                  ApiVersion
                  Optional
                  post string Not PII

                  SMSs to this short code will start a new TwiML session with this API version. Either 2010-04-01 or 2008-08-01.

                  FriendlyName
                  Optional
                  post string Not PII

                  A human readable descriptive text for this resource, up to 64 characters long. By default, the FriendlyName is just the short code.

                  SmsFallbackMethod
                  Optional
                  post http_method Not PII

                  The HTTP method that should be used to request the SmsFallbackUrl. Either GET or POST.

                  SmsFallbackUrl
                  Optional
                  post url Not PII

                  The URL that Twilio will request if an error occurs retrieving or executing the TwiML from SmsUrl.

                  SmsMethod
                  Optional
                  post http_method Not PII

                  The HTTP method Twilio will use when making requests to the SmsUrl. Either GET or POST.

                  SmsUrl
                  Optional
                  post url Not PII

                  The URL Twilio will request when receiving an incoming SMS message to this short code.

                  Example 1
                  Loading Code Sample...
                      
                      
                      
                      
                      Set the SMS Url on a short code to 'http://demo.twilio.com/docs/sms.xml'

                      Update: Change a short code parameter

                      Set the SMS Url on a short code to 'http://demo.twilio.com/docs/sms.xml'

                      Need some help?

                      We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.

                      Loading Code Sample...