Skip to contentSkip to navigationSkip to topbar
On this page

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

base-urls page anchor

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:

  • Message Resource
  • MessageFeedback Resource
  • Media Resource

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.


To authenticate requests to the Twilio APIs, Twilio supports HTTP Basic authentication(link takes you to an external page). Use your API key as the username and your API key's secret as the password. You can create an API key either in the Twilio Console or using the API.

Note: Twilio doesn't recommend using your Account SID and Auth Token in production. For local testing, you can use your Account SID as the username and your Auth token as the password. You can find your Account SID and Auth Token in the Twilio Console(link takes you to an external page).

Learn more about Twilio API authentication.

1
curl -G https://api.twilio.com/2010-04-01/Accounts \
2
-u $TWILIO_API_KEY:$TWILIO_API_KEY_SECRET

Use the Programmable Messaging API

use-the-programmable-messaging-api page anchor
(information)

Info

Twilio monitors messages to prevent content violating the Acceptable Use Policy(link takes you to an external page) (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

send-messages page anchor

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

fetch-list-update-and-delete-messages page anchor

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

fetch-list-and-delete-media page anchor

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

You can fetch, list, and delete Media Subresources.

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

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

Manage your Messaging Services

manage-your-messaging-services page anchor

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

Manage your Messaging Services' senders with:

Check SMS pricing by country

check-sms-pricing-by-country page anchor

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

Retrieve a list of deactivated US phone numbers

retrieve-a-list-of-deactivated-us-phone-numbers page anchor

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