Account & tooling

Account and tooling

Sign in and out, switch organizations, manage API tokens and members, call the API, read the audit log and billing, and keep the CLI up to date.

stackblaze login

Signs the CLI in and saves the credentials to config.json in the CLI's config directory (mode 600; override the path with STACKBLAZE_CONFIG). Browser sign-in prints a URL with the code filled in, opens it, and waits until you approve in the dashboard.

usage
stackblaze login [--browser | --browserless | --password] [--token <token>]

The config directory is ~/.config/stackblaze on macOS and Linux ($XDG_CONFIG_HOME/stackblaze when XDG_CONFIG_HOME is set) and %APPDATA%\StackBlaze on Windows. A login saved by an older version under ~/.config/stackblaze keeps working.

If STACKBLAZE_TOKEN is set, login saves that token instead. Without a terminal and without a token, login fails: in CI, skip login and set STACKBLAZE_TOKEN instead. Create API tokens in the dashboard under Settings, API tokens. The saved file holds a live token, so treat it as a secret.

FlagDescription
--browserOpen the one-click sign-in page (the default in a terminal)
--browserlessPrint the sign-in URL and code without opening a browser (SSH, servers)
--token <token>Sign in with an API token (kbr_pat_…)
--passwordSign in with email or username and password; prompts for a 2FA code when enabled. Needs a terminal
--api-url <url>API to sign in to (default https://api.stackblaze.cloud)

Also accepts the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

Examples

terminal
stackblaze login                          # browser sign-in
stackblaze login --browserless            # approve on another device
stackblaze login --token kbr_pat_xxxxxxxx # API token
stackblaze login --password               # email/username + password (+ 2FA code)

stackblaze logout

Deletes the saved credentials file. The token itself is not revoked; revoke it in the dashboard under Settings, API tokens. STACKBLAZE_TOKEN in your environment is not affected.

usage
stackblaze logout

Also accepts the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

stackblaze whoami

Shows which API you are talking to and who you are: user, organization, the number of projects you can see, and whether Infrastructure as Code is enabled. Exit code 2 means no credentials or a rejected token.

usage
stackblaze whoami

Also accepts the scope flags (-p, --project, -e, --env, -a, --app) and the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

Examples

terminal
stackblaze whoami -o json | jq -r .user.email

stackblaze orgs

Aliases: org, organizations

A login acts in one organization. list shows your organizations, with * on the one this login acts in. switch saves a login scoped to another organization (slug, id or name) where login saves credentials. For a single command, pass the global --org <slug> instead: nothing is saved.

usage
stackblaze orgs list
stackblaze orgs switch <slug>
stackblaze <command> --org <slug>

With a browser login, switch exchanges the token for one in the new organization and revokes the old one; --org uses a short-lived token for that one command. A password login switches its session.

Tokens created on the dashboard's API tokens page are pinned to their organization and cannot switch: orgs switch and a different --org exit 3 with a hint. Run stackblaze login, or use a token created in that organization.

Switching follows the organization's rules: you must be a member, and a suspended organization is refused (exit 3).

Also accepts the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

Examples

terminal
stackblaze orgs list
stackblaze orgs switch side-project
stackblaze apps list --org acme        # this command only

stackblaze tokens

Alias: token

Your API tokens. list shows names, prefixes and dates, never the secrets. create makes a token in the current organization and prints it once. revoke (also delete) revokes a token by id or name.

usage
stackblaze tokens list
stackblaze tokens create <name> [--expires <when>]
stackblaze tokens revoke <id> [-y]

create prints the token once, on stdout (with --json, in the token field), and it cannot be shown again. Store it straight away.

FlagDescription
--expires <when>create: lifetime (30d, 12h, 2w, 1y) or a date (2027-01-31); default 30d
-y, --yesrevoke: skip the confirmation prompt

Also accepts the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

Examples

terminal
stackblaze tokens list
stackblaze tokens create ci --expires 90d --json | jq -r .token | gh secret set STACKBLAZE_TOKEN
stackblaze tokens revoke ci -y

stackblaze members

Alias: member

Members, invitations and roles of the current organization. list shows members and their roles; roles lists the roles you can assign; invite emails an invitation; role changes a member's organization-wide role; remove (also rm) removes a member and keeps their account. invites lists pending invitations (the default) or revokes one.

usage
stackblaze members list
stackblaze members roles
stackblaze members invite <email> [--role <role>]
stackblaze members role <user> <role>
stackblaze members remove <user> [-y]
stackblaze members invites [list [--all] | revoke <invite> [-y]]

Invitation links are emailed and never printed. <user> is an id, email or username; <invite> is an id or email.

FlagDescription
--role <role>invite: role name or id (see members roles)
--allinvites list: include accepted, revoked and expired invitations
-y, --yesremove, invites revoke: skip the confirmation prompt

Also accepts the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

Examples

terminal
stackblaze members list
stackblaze members invite ana@example.com --role member
stackblaze members role ana@example.com admin
stackblaze members invites list --all
stackblaze members remove ana@example.com -y

stackblaze api

Calls any StackBlaze API endpoint with your stored credentials and prints the JSON response. <path> is /api/…; a path without a leading slash gets /api/ prepended.

usage
stackblaze api <method> <path> [-d, --data <json>] [-q, --query <key=value>]...

The response body is printed whatever the status. The exit code is 0 for 2xx, 2 for 401, 3 for 402 or 403 (refused by plan or role) and 1 otherwise.

FlagDescription
-d, --data <json>Request body: JSON, @file, or @- (stdin)
-q, --query <key=value>Query parameter (repeatable)

Also accepts the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

Examples

terminal
stackblaze api GET /api/pipelines
stackblaze api GET audit -q limit=5
stackblaze api POST /api/pipelines/demo/phases --data '{"name":"staging"}'

stackblaze audit

Prints recent audit log entries: who did what, and when. With an app in scope it shows that app's entries; otherwise your organization's. Text output shows the newest 20; -o json returns everything fetched.

usage
stackblaze audit [options]
FlagDescription
--action <keyword>Only entries whose action contains this text, e.g. delete, scale
--actor <user>Only entries whose actor contains this text
--since-minutes <n>Only entries from the last n minutes
-n, --limit <n>Entries to fetch before filtering (default 100)

Also accepts the scope flags (-p, --project, -e, --env, -a, --app) and the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

Examples

terminal
stackblaze audit --action delete --since-minutes 1440

stackblaze billing

Shows your plan, usage credit, and a breakdown of resources.

usage
stackblaze billing

Also accepts the scope flags (-p, --project, -e, --env, -a, --app) and the output flags (-o, --output, --json), plus --token, --api-url and --org. Common flags

stackblaze completion

Prints a shell completion script to stdout. Regenerate it after upgrading to pick up new commands.

usage
stackblaze completion bash|zsh|fish|powershell

Examples

terminal
# bash
stackblaze completion bash > ~/.local/share/bash-completion/completions/stackblaze
# zsh
stackblaze completion zsh > "${fpath[1]}/_stackblaze"
# fish
stackblaze completion fish > ~/.config/fish/completions/stackblaze.fish
# PowerShell (add the line to $PROFILE to keep it)
stackblaze completion powershell | Out-String | Invoke-Expression

stackblaze upgrade

Downloads the newest CLI build for your platform and replaces the running binary. If you installed with Homebrew, run brew upgrade stackblaze instead: upgrade refuses to replace a Homebrew-managed binary. Re-running the installer also upgrades.

usage
stackblaze upgrade [--channel stable|dev] [--version <x.y.z>] [--install-path <file>]

upgrade never moves you to an older or the same release: when the newest release on the channel is not newer than the running CLI, it reports that you are up to date and changes nothing. --version installs exactly the version it names, older ones included.

On Linux and macOS the old binary is kept next to the new one as stackblaze.bak. On Windows the running binary cannot be replaced, so upgrade writes stackblaze.new.exe next to it and asks you to swap the files after closing the terminal. Check the version with stackblaze --version.

FlagDescription
--channel <name>stable (default) or dev (prereleases)
--version <tag>Install a specific version, e.g. 1.0.0 (older versions too)
--install-path <path>Binary to replace (default: the running binary). Also skips the Homebrew check
--orasDownload with the oras tool instead of the built-in client

Examples

terminal
stackblaze upgrade
stackblaze upgrade --version 1.0.0
brew upgrade stackblaze      # Homebrew installs

stackblaze docs

Prints the CLI documentation URL (this reference) and opens it in your browser.

usage
stackblaze docs [--no-browser]
FlagDescription
--no-browserOnly print the URL