Level 0: Twilio Explorer

Project: Getting Started with Twilio - REST API

Task 1: The Twilio REST API

Introducing the Twilio REST API

The Twilio REST API is the service which exposes the Twilio cloud to your application. Use the REST API to initiate outbound communications, such as placing calls or sending messages. To do this, your application makes a HTTP POST request to a Twilio API resource. When Twilio receives the POST request, a call or SMS is created in your Twilio account, which enters a queue for delivery shortly after.

The REST API also allows you to view, delete or query meta-data about various resources which comprise the Twilio cloud. For example, your phone numbers, calls, text messages and recordings are all REST API resources. Since the API is based on REST principles , it's very easy to write and test applications. You can use your browser to inspect most Twilio resources, or any HTTP client in any programming language to interact with the API.

The REST API documentation is the definitive guide to this service and a resource you'll use frequently during development.

Your first Twilio REST API request (using the API Explorer)

Your Twilio account includes an API Explorer . This is a handy web tool which allows you to create Twilio REST API requests - no coding required. It's a great place to explore and learn about the various REST API resources and their usage. You can find the API explorer by clicking the 'Dev Tools' button at the top of your Twilio account portal, then click the'API Explorer' link which appears underneath.

Let's use the API Explorer to send an SMS message .

  1. Access the Send Message page of the API explorer.
  2. Review the API docs for this call. Note this is an HTTP 'POST' request to the '/Messages' resource. We must specify the required parameters of 'To' and 'From', and a conditional field 'Body'.
  3. In the API explorer, enter your mobile phone number in the 'To' field.
  4. Select a Twilio number in your account for the 'From' field value.
  5. Enter 'Ahoy from the Twilio REST API' in the 'Body' field.
  6. Scroll down to the bottom of the page and click the red 'Make Request'
  7. The API explorer makes the REST API request. Note the generated code. Your AccountSid is automatically added to the REST API resource URL, and HTTP authentication is included using your AccountSid and Auth Token.
  8. Scroll down under the 'Make Request' button to review Twilio's API response.
  9. If you received 'Response 201' - congratulations, your first Twilio API request was successful. Note the 'sid' in the json output, this is Twilio's unique identifier for this message. You will need to submit this in the next section.
  10. If you received a non-201 response, this indicates the API call was not successful. In the json output, review the returned 'message' value for more information about how to correct the problem.

Congratulations, you've just made a REST API request to the Twilio API. You POSTed to the /Messages resource to create a new SMS message.

Please note Twilio phone numbers have varying messaging capabilities. Some phone numbers can SMS to any global destination (such as US Twilio numbers), some can only send to their own locale, and others aren't able to send SMS at all. In order to find out which countries Twilio has phone numbers available and their capabilities, please refer to this FAQ .

Submit for validation


Please grant Twilio <Skills> read-only access to your Twilio account using the Twilio Connect API. We will use this to validate account configuration and log data related to the project you are submitting. You should only use a dedicated developer account for submitting projects and should not grant access to any production accounts.

You can revoke access to your account at any time from your Twilio billing page

You are authorized with Twilio Connect for read-only access to your account and logs.

You can revoke access to your account at any time from your Twilio billing page

Now that you have a working app, submit it for automatic validation. Enter your Message SID:

Message SID:  

 I verify that the work I am submitting is my own and that I comply with the Code of Ethics.


Status: {{validationC.currentAttempt.status}}

Status: {{validationC.currentAttempt.status}}

Status: {{validationC.currentAttempt.status}}

Status: {{test.status}}

Next Task: REST API in detail


Powered by