Authentication
This documentation is part of the Use 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 authentication options:
Interactive browser-based login
stackhero login
When you run this command, the CLI gives you 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.
Non-interactive authentication for scripts, CI, and automation
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 priority over interactive sessions, so using a browser becomes optional. This approach works very well for non-interactive use cases. You can review and revoke tokens from your dashboard at any time.