SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

How to change the "from" number or sender ID for sending SMS messages

Objective

Changing the "From" number of a Sender ID for sending SMS

Product

Programmable Messaging

Procedure

Changing the "From" number or Sender ID for outgoing SMS messages can be accomplished by changing the From parameter in your API requests.

Here's how to change the From parameter you use through Twilio:

Twilio Phone Numbers and Hosted SMS numbers

Any SMS-enabled Twilio phone number or Hosted SMS number on your account can be used to send SMS messages. To use a phone number for sending messages, input your phone number in the From parameter of your API request using E.164 formatting.

Here’s an example cURL script - notice the From parameter updated in line 4. For full details, please see our Programmable SMS REST API documentation.

curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages.json \
-d "Body=Hello from my phone number" \
-d "To=+12685551234" \
-d "From=+12685555555" \
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'

SMS support for your number can be checked via a number of methods:

  • Console: SMS support for Twilio Phone Numbers can be viewed at www.twilio.com/console/phone-numbers. Supported numbers will have an SMS icon under the CAPABILITIES heading.
  • API: A GET request to the IncomingPhoneNumbers API Resource will also return SMS support information for your Twilio Phone Numbers. Our response will include a Capabilities property with boolean true/false values for SMS and MMS capabilities.

Note: You can not spoof messages from your own cell phone number. The From parameter can only display a Twilio number on your project, or an Alphanumeric Sender ID (where available).

Alphanumeric Sender IDs

An alphanumeric sender ID of up to 11 characters can be used for sending messages to all supported countries where registration is not required. To use an Alphanumeric Sender ID for sending messages, input your ID in the From parameter of your API request.

Here’s an example cURL script - notice the From parameter updated in line 4. For full details, please see our Programmable SMS REST API documentation.

curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages.json \
-d "Body=Hello there" \
-d "To=+12685551234" \
-d "From=MyCompany" \
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'

If you’re using a registered Alphanumeric Sender ID, you can also pass it directly into the From value of your API Request. Be sure to match the registered Alphanumeric Sender ID exactly because in many cases SMS carriers will check for case-sensitive matches on registrations.

If your application is set up in such a way that a phone number or other unregistered sender could be passed as your From parameter instead of the registered sender, then you can configure one of your registered Alphanumeric Sender IDs as a Default Sender ID for a country. The Default Sender ID will be used to overwrite your From parameter at send time in any case that the From value doesn’t match a registered Alphanumeric Sender ID for that destination. See here for more details.

Note: Alphanumeric Sender ID messages are one-way only, it is not possible to reply to messages sent from Alphanumeric Sender IDs. For full details, please see our article for Getting started with Alphanumeric Sender ID.

 

Twilio Short Codes

Short codes send Twilio Programmable SMS messages in the same way. To use a short code for sending messages, input your short code number in the From parameter of your API Request. Note that short codes do not have a leading plus sign or country code, and should be formatted exactly as they appear on Twilio.

Here’s an example cURL script - notice the From parameter updated in line 4. For full details, please see our Programmable SMS REST API documentation.

curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages.json \
-d "Body=Hello from 123456" \
-d "To=+13105551234" \ -d "From=123456" \
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'

Note: Short codes have different throughput options and purchase requirements than standard Twilio phone numbers. For full details, please see our article What is a short code.

 

Additional Information

Please note, if you are sending messages using a Twilio number from a different country as your recipients, the Sender ID shown on the user's device may be different than your Twilio number. For more info, see Why do some SMS recipients see a Sender ID that is not my Twilio number?

Have more questions? Submit a request
Powered by Zendesk