Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Command-Line Interface (CLI) Quickstart


The Twilio CLI allows you to manage your Twilio resources from your terminal or command prompt. Let's get it installed and take a quick tour.

(information)

Info

Starting with Twilio CLI version 6.0.0, only Node.js version 20 or later is supported. If you are using an older version of Node.js, please upgrade to Node.js version 20 or later. For more information, see Twilio CLI Node.js 18 version deprecation.


Install the Twilio CLI

install-the-twilio-cli page anchor

Choose your preferred installation method from the following options:

homebrewaptscoopDockernpm

To install the CLI on macOS using Homebrew(link takes you to an external page), run:

brew tap twilio/brew && brew install twilio
(information)

Info

Refer to the CLI install documentation for more installation methods.

Once the CLI has finished installing, run twilio --version (or twilio -v) to verify your installation.

You'll see output similar to the following:

1
$ twilio --version
2
twilio-cli/6.0.1 linux-x64 node-v20.19.3

Log in to your Twilio account

log-in-to-your-twilio-account page anchor

For the CLI to access your Twilio account and execute commands on your behalf, you need to log in and provide your Twilio credentials.

Run the following command to log in:

twilio login

You will be prompted for your Account SID and Auth Token, both of which you can find on the dashboard of your Twilio Console(link takes you to an external page).

This will create an API Key for you that will be stored securely and used to issue authenticated requests as you use the CLI. This secure API Key and your settings will be stored locally as a profile.

(information)

Info

Refer to the profiles guide if you would like to use multiple accounts or profiles with the Twilio CLI on the same machine.


Install CLI autocomplete (Bash or Zsh only)

install-cli-autocomplete-bash-or-zsh-only page anchor

Autocomplete allows you to type part of a command, parameter, or flag, and the Twilio CLI will either complete the command or display suggestions for you. If you have autocomplete turned on, you can prompt the CLI for these suggestions by pressing the Tab key.

Turn on autocomplete by running the appropriate command for your shell:

bashzsh
twilio autocomplete bash

Follow the resulting instructions and either restart your shell or open another instance to finish installing command autocomplete.

(warning)

Warning

If suggestions aren't appearing, double-check that you restarted your shell or opened another instance since installing.


The best way to learn about what you can do with the CLI is to run the following command:

twilio

When you do, you will get a list of the various topics and commands available to run. Topics are groupings for more topics and commands, similar to the folder structure on your file system.

You'll see output similar to this:

1
$ twilio
2
Unleash the power of Twilio from your command prompt. Visit https://twil.io/cli for documentation.
3
4
VERSION
5
twilio-cli/6.0.1 linux-x64 node-v20.19.3
6
7
USAGE
8
$ twilio [COMMAND]
9
10
TOPICS
11
api advanced access to all of the Twilio APIs
12
config manage Twilio CLI configurations
13
debugger Show a list of log events generated for the account
14
email sends emails to single or multiple recipients using Twilio SendGrid
15
feedback provide feedback to the CLI team
16
phone-numbers manage Twilio phone numbers
17
plugins list available plugins for installation
18
profiles manage credentials for Twilio profiles
19
20
COMMANDS
21
autocomplete display autocomplete installation instructions
22
feedback provide feedback to the CLI team
23
help display help for twilio
24
login create a new profile to store Twilio Account credentials and configuration
25
plugins list installed plugins
26
update update the twilio CLI

See something that looks interesting? Just try running it:

twilio api -h

Since api is a topic, you will actually be shown more topics and commands that are contained within that topic.

For example, you might discover this command:

twilio api:core:messages:list

If you run that command, it will list all of your SMS messages, which may be a lot. How can you filter them? Or, more generally, how can you discover what options a given CLI command provides?

Add --help or -h to the command like so:

twilio api:core:messages:list --help
twilio api:serverless:v1:services:create -h

If you type a command, you might get an error if you haven't provided all the required options. This is another situation where adding --help or -h to the command can give you more information.

(information)

Info

You can use spaces instead of colons when entering commands. These two commands are functionally identical:

twilio api:core:messages:list
twilio api core messages list

List your Twilio phone numbers

list-your-twilio-phone-numbers page anchor
twilio phone-numbers:list
1
twilio api core messages create \
2
--from "+15017122661" \
3
--to "+15558675310" \
4
--body "I sent this from my terminal 😎"

After completing this quickstart, explore these resources to learn more:

View our examples for inspiration on what you can do with the Twilio CLI.

Read the general usage guide

read-the-general-usage-guide page anchor

Refer to our general usage guide to read more about a variety of CLI features:

The Twilio CLI can be extended via plugins. You can publish your own for the community, or make them private for your own (or your clients') business workflows. There are already a number of plugins available for you to extend your CLI.

Finally, we'd love to hear from you. Any time you have feedback you'd like to send us, run:

twilio feedback