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.


HTTP requests to the API use HTTP basic authentication(link takes you to an external page).

Use your Twilio Account SID as the username and your Auth Token (found in the Console(link takes you to an external page)) 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.

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

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

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.


Need some help?

Terms of service

Copyright © 2024 Twilio Inc.