Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

How to Use Our REST APIs


Twilio's APIs (Application Programming Interfaces) power its platform for communications. Behind these APIs is a software layer connecting and optimizing communications networks around the world to allow your users to call and message anyone, globally.

(information)

Info

Twilio has a whole host of APIs, from SMS to Voice to Wireless. You can find Twilio's API reference documentation throughout our product documentation. You can browse the various APIs here, or jump straight to the API reference for Programmable SMS or Programmable Voice.


What is a REST API, anyway?

what-is-a-rest-api-anyway page anchor

API is short for 'Application Programming Interface' . An API is a set of rules that lets programs talk to each other, exposing data and functionality across the Internet in a consistent format.

REST stands for 'Representational State Transfer(link takes you to an external page)'. This is an architectural pattern that describes how distributed systems can expose a consistent interface. When people use the term 'REST API', they are generally referring to an API accessed using the HTTP protocol at a predefined set of URLs.

These URLs represent various resources — any information or content accessed at that location, which can be returned as JSON, HTML, audio files, or images. Often resources have one or more methods that can be performed on them over HTTP, like GET, POST, PUT, and DELETE. The action represented by the first and last of these is clear, but POST and PUT have specific meanings. How they are defined is confusing, but the general rule is: use POST to create resources, and PUT to update resources.

Twilio, for example, provides many separate REST APIs for sending text messages, making phone calls, looking up phone numbers, managing your accounts, and a whole lot more. In Twilio's ecosystem, each product is its own API, but you will work with each of them in roughly the same way, whether directly over HTTP or using Twilio's helper libraries for several different programming languages.


Working with Twilio's APIs

working-with-twilios-apis page anchor

Authenticate with HTTP

authenticate-with-http page anchor

Twilio supports HTTP Basic authentication(link takes you to an external page). This allows you to protect the URLs on your web server so that only you and Twilio can access them. In order to authenticate with HTTP, you may provide a username and password with the following URL format:


_10
https://username:password@api.twilio.com/2010-04-01/your_desired_path

For HTTP Basic authentication, you will use your Twilio account SID as your username and your auth token as your password:


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

You can find both your account SID and auth token in the Twilio Console(link takes you to an external page) after signing up for a free Twilio trial account(link takes you to an external page).

Reveal Your Auth Token.Rate this page:

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.