Getting Started

Get API Credentials

This guide will walk you through obtaining your Twilio API credentials so you can start making API calls. The steps are the following:

  1. Create a Twilio account, if you haven't done so.
  2. Locate your Account SID and Auth Token.
  3. Use the credentials to make your first API call.

Let's get started!

Prerequisites

  • A Twilio account (free trial or paid). You can sign up at twilio.com.
  • We will use cURL to make API calls. You can install it from here or use the package manager of your choice.

Set Up Your Account

Navigate to the Twilio Console and log in. If you don't have an account yet, click Sign Up and follow the prompts to create a free trial account.

During sign-up, Twilio will ask you to verify your email address and phone number. Complete these steps to activate your account.

Find Your API Credentials

Twilio uses two key credentials for API authentication:

  • Account SID — Your unique account identifier.
  • Auth Token — Your secret key used to authenticate API requests.

To locate them:

  1. Log in to the Twilio Console.
  2. On the main dashboard, your Account SID and Auth Token are displayed under the Account Info section.
  3. The Account SID is visible by default. Click on the Auth Token field to reveal it.
  4. Copy both values and store them securely. Treat your Auth Token like a password — do not share it publicly.

Important: Never expose your Auth Token in client-side code or public repositories. Always keep it on the server side.

Make Your First API Call

With your credentials in hand, you are ready to make your first API call. Let's retrieve your Twilio account information using the Fetch Account endpoint.

Replace YOUR_ACCOUNT_SID and YOUR_AUTH_TOKEN with your actual credentials:

curl -X GET "https://api.twilio.com/2010-04-01/Accounts/YOUR_ACCOUNT_SID.json" \
     -u YOUR_ACCOUNT_SID:YOUR_AUTH_TOKEN

If everything goes well, the API will return a JSON response with your account details:

{
  "sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "friendly_name": "My Twilio Account",
  "status": "active",
  "type": "Full",
  "date_created": "Mon, 01 Jan 2024 00:00:00 +0000",
  "date_updated": "Mon, 01 Jan 2024 00:00:00 +0000",
  "auth_token": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json"
}

Congratulations! You have successfully authenticated and made your first API call to the Twilio API.

Regenerating Your Auth Token

If you believe your Auth Token has been compromised, you can regenerate it:

  1. Go to the Twilio Console.
  2. Navigate to Account > API keys & tokens.
  3. Click Regenerate Auth Token.
  4. Update your applications with the new token, as the previous one will be invalidated immediately.

Summary

The Twilio API uses Account SID and Auth Token for authentication via HTTP Basic Auth. These credentials can be found on the main dashboard of the Twilio Console. All API requests must include these credentials to authorize access.

What's Next?

  • Head over to the API Recipes section to follow step-by-step guides for common use cases like sending SMS, setting up chat, or verifying phone numbers.
  • Explore the API Endpoints section for detailed reference documentation on all available Twilio APIs.
  • Check out the Sample App section to see a working example built with the Twilio API.

On this page