Menu

Messaging API Overview

The Programmable Messaging REST API helps you add robust messaging capabilities to your applications.

With the REST API, you can:

Base URLs

Twilio's APIs are served over HTTPS. To ensure data privacy, unencrypted HTTP is not supported.

The following API Resources use https://api.twilio.com/2010-04-01 as the base URL:

API Resources related to Messaging Services use https://messaging.twilio.com/v1:

The Deactivations Resource also uses the https://messaging.twilio.com/v1 base URL.

Pricing information for Messaging uses the https://pricing.twilio.com/v1 base URL.

Authentication

HTTP requests to the API use HTTP basic authentication.

Use your Twilio Account SID as the username and your Auth Token (found in the Console) as the password for HTTP basic authentication when sending HTTP requests to Twilio.

The code samples in the API documentation show how and where to put your Account SID and Auth Token if you're using a Helper Library or curl to communicate with Twilio's API.

The example below shows how to send your Account SID and Auth Token when using a curl command.

curl -G https://api.twilio.com/2010-04-01/Accounts \
     -u <YOUR_ACCOUNT_SID>:<YOUR_AUTH_TOKEN>

To learn more about interacting with Twilio's REST API, check out the Usage docs on sending requests to Twilio's REST APIs, Twilio’s response to API requests, and security documentation.

Use the Programmable Messaging API

Twilio monitors messages to prevent content violating the Acceptable Use Policy (AUP). This helps to ensure that Twilio Messaging is seen as a trustworthy, high engagement channel and will not slow down the delivery of messages.

If a message you send has violated the AUP, it will be returned and you will receive an error code which identifies the necessary changes you need to make before sending it again.

Send messages

To send an outbound message, send a POST request to the Message Resource.

Looking for information on how to receive and reply to messages? Check out the Receive and Reply to Messages Guide.

Fetch, list, update, and delete messages

Use the Message Resource to fetch, list, and delete Messages associated with your Account.

Redact messages by updating a Message Resource.

Fetch, list, and delete media

Twilio creates a Media Subresource when an incoming or outgoing Message Resource contains media.

You can fetch, list, and delete Media Subresources.

Manage your short codes

Fetch, list, and update your Account's short codes with the ShortCode Resource.

Track message feedback

Track user-reported outcomes of Messages with the MessageFeedback Subresource.

Manage your Messaging Services

Create, fetch, read, update, and delete Messaging Services with the Service Resource.

Manage your Messaging Services' senders with:

Check SMS pricing by country

See inbound and outbound SMS message pricing with the Country Pricing Resource.

Retrieve a list of deactivated US phone numbers

Fetch a list of all US phone numbers that were deactivated on a given day with the Deactivations Resource.

Additional Resources

Rate this page:

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 by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

Thank you for your feedback!

Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

Sending your feedback...
🎉 Thank you for your feedback!
Something went wrong. Please try again.

Thanks for your feedback!

thanks-feedback-gif