Authentication

This documentation is part of the Manage services with the CLI guide. You can view the complete guide here: Install and use the Stackhero CLI to manage your stacks and services from the command line, scripts, CI, and AI agents.

You have two main options for authentication:

stackhero login

When you run this command, the CLI provides you with a URL and also opens it automatically in your browser. From there, you can approve access directly from your Stackhero dashboard, where you are already signed in.

Two-factor authentication is fully supported, and you do not need to enter your password in the CLI.

For automated workflows, you can create an access token in your dashboard under Account > Access tokens and provide it to the CLI using the STACKHERO_TOKEN environment variable.

export STACKHERO_TOKEN="usr-xxxxxx:your-token"
stackhero organizations-list

When STACKHERO_TOKEN is set, it takes precedence over interactive sessions, so a browser is optional. This method is ideal for non-interactive use cases. You can review and revoke your tokens from your dashboard at any time.