Skip to main content
The CLI resolves credentials from flags, environment variables, and saved contexts. Choose the method that fits your workflow.

Token resolution order

The CLI checks for an API token in this order:
  1. --api-token flag on the command
  2. DEVHELM_API_TOKEN environment variable
  3. Saved context in ~/.devhelm/contexts.json
The first match wins. If no token is found, the command fails with exit code 2.
export DEVHELM_API_TOKEN=dh_live_xxxxxxxx
Set this in your CI/CD pipeline as a secret. All commands will use it automatically.

Interactive login

Log in from your terminal to save credentials locally:
devhelm auth login
This prompts for your API token and saves it to ~/.devhelm/contexts.json under a named context. To skip the interactive prompt:
devhelm auth login --token dh_live_xxxxxxxx

Verify your identity

devhelm auth me
Returns your user details and current organization. Use --output json for machine-readable output.

Named contexts

Contexts let you switch between multiple accounts or environments without re-entering credentials.

Create a context

devhelm auth context create staging \
  --token dh_live_xxxxxxxx \
  --api-url https://api.devhelm.io
By default, the new context becomes the active one. Pass --no-set-current to create without switching.

List contexts

devhelm auth context list
The active context is marked with an asterisk.

Switch context

devhelm auth context use production

Delete a context

devhelm auth context delete staging

Log out

Clear the active context’s saved credentials:
devhelm auth logout

Display the current token

Useful for piping into other tools:
devhelm auth token

Precedence override

Even with a saved context, you can override on a per-command basis:
devhelm monitors list --api-token dh_live_other_token

Next steps

Global flags

Output format, verbosity, and other global options.

Auth commands

Full reference for all auth subcommands.