Skip to Content
CLI & APICommand reference

stackblaze tokens

Your API tokens

Usage: stackblaze tokens|token [options] [command]

Your API tokens

Options:
  -h, --help                    Print help

Commands:
  list|ls [options]             List your API tokens (names, prefixes and
                                dates; never the secrets)
  create [options] <name>       Create an API token in the current
                                organization; prints it ONCE
  revoke|delete [options] <id>  Revoke an API token (id or name)
  help [command]                Print this message or the help of the given
                                subcommand(s)

tokens list

Usage: stackblaze tokens list|ls [options]

List your API tokens (names, prefixes and dates; never the secrets)

Options:
  --api-url <url>        StackBlaze API base URL (env STACKBLAZE_API_URL)
  --token <token>        API token, sb_pat_... (env STACKBLAZE_TOKEN)
  --json                 Output JSON (same as -o json) (default: false)
  -o, --output <format>  Output format: text or json (choices: "text", "json")
  -h, --help             Print help

Example

List your API tokens. Only names, prefixes and dates are shown, never the secrets. Each stackblaze login in a browser adds a CLI · <date> token:

stackblaze tokens list
┌───────────────────────────┬─────────────────────────────────────────────────────────┬─────────────────┬────────────┬────────────┬────────────┐
│ ID                        │ Name                                                    │ Prefix          │ Created    │ Expires    │ Last used  │
├───────────────────────────┼─────────────────────────────────────────────────────────┼─────────────────┼────────────┼────────────┼────────────┤
│ cmvreqvnx002kw8011bbwbk2q │ CLI · 2026-10-28                                        │ sb_pat_…        │ 2026-10-28 │ 2027-10-28 │ 2026-10-28 │
├───────────────────────────┼─────────────────────────────────────────────────────────┼─────────────────┼────────────┼────────────┼────────────┤
…
├───────────────────────────┼─────────────────────────────────────────────────────────┼─────────────────┼────────────┼────────────┼────────────┤
│ cmwu9eok6024usr01zojl6bl6 │ CLI · 2026-11-24                                        │ sb_pat_…        │ 2026-11-24 │ 2027-11-24 │ 2026-11-25 │
├───────────────────────────┼─────────────────────────────────────────────────────────┼─────────────────┼────────────┼────────────┼────────────┤
…
└───────────────────────────┴─────────────────────────────────────────────────────────┴─────────────────┴────────────┴────────────┴────────────┘

tokens create

Usage: stackblaze tokens create [options] <name>

Create an API token in the current organization; prints it ONCE

Options:
  --api-url <url>        StackBlaze API base URL (env STACKBLAZE_API_URL)
  --token <token>        API token, sb_pat_... (env STACKBLAZE_TOKEN)
  --json                 Output JSON (same as -o json) (default: false)
  --expires <when>       Lifetime (30d, 12h, 2w, 1y) or a date (2027-01-31)
                         (default: "30d")
  -o, --output <format>  Output format: text or json (choices: "text", "json")
  -h, --help             Print help

The token is printed once (stdout; --json: the "token" field) and cannot be
shown again. Store it straight away, e.g.:
  $ stackblaze tokens create ci --expires 90d --json | jq -r .token | gh secret set STACKBLAZE_TOKEN

tokens revoke

Usage: stackblaze tokens revoke|delete [options] <id>

Revoke an API token (id or name)

Options:
  --api-url <url>        StackBlaze API base URL (env STACKBLAZE_API_URL)
  --token <token>        API token, sb_pat_... (env STACKBLAZE_TOKEN)
  --json                 Output JSON (same as -o json) (default: false)
  -y, --yes              Skip confirmation prompt (default: false)
  -o, --output <format>  Output format: text or json (choices: "text", "json")
  -h, --help             Print help

Example

Revoke a token you no longer use, by its ID from stackblaze tokens list (a name works too when it's unique). The CLI asks first:

stackblaze tokens revoke cmww81ta7005huz01djfqp8kx
Revoke token "CLI · 2026-11-25" (cmww81ta7005huz01djfqp8kx)? Anything using it stops working [y/N]: y
OK Revoked token CLI · 2026-11-25

A machine still signed in with that token is refused from then on:

stackblaze whoami
x  Unauthorized

On this page