Movatterモバイル変換


[0]ホーム

URL:


Skip to contentSkip to navigationSkip to topbar
Go to the Twilio Docs home page
Twilio Docs

Profiles


Profiles allow you to store and group together credentials and certain settings in the Twilio CLI. This is handy for persisting your preferred options between terminal sessions, and allows for streamlined context switching between multiple accounts.


To issue CLI commands that include your Twilio credentials, you must first create a profile. To create a profile, use:

twiliologin

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

When you runtwilio login (an alias fortwilio profiles:create), it uses your Account SID and Auth Token to generate an API key, stores the key in a configuration file, and associates the key with the profile to authenticate future requests.

For security, your Auth Token isonly used to generate the API key, and is not stored locally once the profile has been created.

Use additional profiles to quickly switch between different sets of configurations within the same account, or between entirely different Twilio accounts.

To create additional profiles, runtwilio login again, but provide a different shorthand identifier for the profile when prompted.

For example, to create a profile named "dev":

1
$twilio login
2
Youcan find your Account SID and Auth Token at https://www.twilio.com/console
3
»Your Auth Token will be used once to create an API Key for future CLI access to your Twilio Account or Subaccount, and then forgotten.
4
?The Account SIDforyour Twilio Account or Subaccount: ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5
?Your Twilio Auth Tokenforyour Twilio Account or Subaccount: [hidden]
6
?Shorthand identifierforyour profile: dev
(information)

Info

Your Account SID and Auth Token are accessible from the first page of theTwilio Console(link takes you to an external page), underAccount Info.


By default, the credentials associated with the "active" profile are used when you run a Twilio CLI command that doesn't reference a specific profile to use.

To set a profile as "active", run:

twilioprofiles:use PROFILE_ID
(information)

Info

twilio login does not set the provided profile as "active". Use the instructions above to set a newly-created profile as the "active" profile.


To use non-active profiles with commands, include-p PROFILE_ID in the command. This could look like:

twiliophone-numbers:list-pdev

Alternatively, as shownearlier, you may change the active profile with thetwilio profiles:use command:

twilioprofiles:use dev

To see the full list of local profiles (including which profile is active), run:

twilioprofiles:list

To remove a profile, use:

twilioprofiles:remove PROFILE_ID

For example, if you want to remove thedev profile, you would executetwilio profiles:remove dev


Use environment variables

use-environment-variables page anchor

Instead of (or in addition to) using a profile, you may define credentials as environment variables before issuing CLI commands.

If these environment variables are set, a profile is not required to issue commands with the Twilio CLI.

(error)

Danger

If you are in the rare situation where you cannot make use of an API Key, you can instead leverage your primary account credentials:

  • TWILIO_ACCOUNT_SID - your Account SID
  • TWILIO_AUTH_TOKEN - your Auth Token

This is highly discouraged due to increased risk of exposing your Auth Token.


Precedence of stored credentials

precedence-of-stored-credentials page anchor

The CLI will attempt to load credentials in the following order of priority:

  1. From the profile specified by the-p parameter
  2. From environment variables, if set
  3. From the active profile

[8]ページ先頭

©2009-2025 Movatter.jp