doctl auth init

Go to Navigation


doctl auth init [flags]


This command allows you to initialize doctl with a token that allows it to query and manage your account details and resources.

You will need an API token, which you can generate in the control panel at

You can provide a name to this initialization via the --context flag, and then it will be saved as an “authentication context”. Authentication contexts are accessible via doctl auth switch, which re-initializes doctl, or by providing the --context flag when using any doctl command (to specify that auth context for just one command). This enables you to use multiple DigitalOcean accounts with doctl, or tokens that have different authentication scopes.

If the --context flag is not specified, a default authentication context will be created during initialization.

If doctl is never initialized, you will need to specify an API token whenever you use a doctl command via the --access-token flag.


--help, -hHelp for this command
doctl authDisplay commands for authenticating doctl with an account

Global Flags

--access-token, -tAPI V2 access token
--api-url, -uOverride default API endpoint
--config, -cSpecify a custom config file
  • macOS: ${HOME}/Library/Application Support/doctl/config.yaml
  • Linux: ${XDG_CONFIG_HOME}/doctl/config.yaml
  • Windows: %APPDATA%\doctl\config.yaml
--contextSpecify a custom authentication context name
--output, -oDesired output format [text|json]
Default: text
--traceShow a log of network activity while performing a command
Default: false
--verbose, -vEnable verbose output
Default: false