Skip to Content
CLI & APICommand reference

CLI reference

Every stackblaze command, from the CLI's own help (version 1.1.21).

Generated from stackblaze --help on CLI 1.1.21.

Interact with StackBlaze via CLI

Tip: Using an AI coding agent? Run `stackblaze setup agent -y` to install StackBlaze skills and the MCP server.

Usage: stackblaze [COMMAND]

Commands:
  addons         Platform addons [aliases: addon]
  agent          Chat with the StackBlaze agent (interactive REPL, or one-shot with a prompt)
  api            Call any StackBlaze API endpoint with your stored auth and print the JSON response
  apply          Create or update resources declared in a manifest file or directory
  apps           Manage apps [aliases: app]
  audit          Show audit trail (who did what, when)
  backups        Recovery points of a project environment: back up, restore as new databases and volumes [aliases: backup]
  billing        Show plan, usage credit, and resource breakdown; `billing limit` sets the on-demand spending limit, `billing gpu-credit` the prepaid GPU credit
  builds         Git build jobs [aliases: build]
  cdn            Edge cache (CDN) of the linked app
  completion     Generate shell completion scripts (bash, zsh, fish, or powershell)
  connect        Open an interactive database shell (psql, mysql, or redis-cli); [addon] = postgres, mysql or redis, optional when the app has exactly one database addon
  context        Show resolved CLI context (API URL, project, environment, app)
  cron           Scheduled tasks of the linked app
  db             Inspect an environment's database add-ons (PostgreSQL, MariaDB, Valkey, …) [aliases: database]
  deploy         Redeploy the linked app, or ship staged changes with --apply-pending
  deployments    Deployment history and rollback [aliases: deployment]
  destroy        Delete resources declared in a manifest file or directory
  diagnose       Diagnose app performance (config, metrics, logs, addons)
  docs           Open StackBlaze CLI documentation in the default browser
  domain         Add, verify, list, or remove custom domains for an app [aliases: domains]
  down           Pause the linked app: stop all its pods (web, worker, cron jobs) but keep the deployment
  env            Remote environment
  events         Show recent events for an app
  export         Write the current projects and apps out as manifests
  files          Volume mount files (persistent PVC data)
  functions      Manage functions: one TypeScript file run on Bun [aliases: function, func, fn, fns]
  help           Print this message or the help of the given subcommand(s)
  import         Create the services and databases a docker-compose.yml, render.yaml, fly.toml or stackblaze.yaml describes, in a project environment
  init           Create a project and link this directory [aliases: new]
  inspect        Analyze cwd or a public git URL for deployment planning
  link           Link this directory to a project / environment / app (.stackblaze/project.json)
  list           List projects (alias for projects list) [aliases: ls]
  log-drains     Durable log drains of the linked app (ship logs to syslog, HTTP, Datadog, Quickwit) [aliases: logdrains, drains]
  login          Sign in via browser (one-click device login) or --token / --password
  logout         Remove saved credentials from this machine
  logs           Fetch app logs (live history, --follow stream, or --search)
  members        Organization members, invitations and roles [aliases: member]
  metrics        Show CPU/memory usage for an app (now, or history with --since)
  models         AI models: open models served on GPUs behind an OpenAI-compatible URL, in a project environment [aliases: model, ai-models]
  notifications  Slack, Discord and webhook notifications of your organization [aliases: notification]
  open           Open the dashboard page for the linked app or project
  orgs           List and switch organizations [aliases: org, organizations]
  pending        Changes staged with --skip-deploy (server-side, per app)
  phases         Manage a project's environments [aliases: phase, environments]
  plan           Show what apply would create or change, without making changes
  previews       Manage a project's preview environments (per-branch preview apps) [aliases: preview]
  projects       Manage projects [aliases: project, pipelines, pipeline]
  proxy          Forward a local port to one of the app's ports through a private tunnel (default: a free local port → the app's http port) [aliases: port-forward]
  redeploy       Redeploy the linked app: git apps rebuild, image apps re-pull (or --tag)
  regions        List the regions a project can be created in (* = your workspace default) [aliases: region]
  registry       The organization's private registry login, for deploying private images (default: status)
  restart        Restart the linked app without rebuilding
  resume         Resume an app paused with `stackblaze down`
  run            Run a local command with remote app environment variables
  sandboxes      Developer sandboxes: disposable VMs with a shell and VS Code in a project environment [aliases: sandbox, sbx]
  scale          Scale web/worker instances or autoscaling for the linked app (one release)
  setup          Developer tooling setup
  shell          Open an interactive subshell with the app environment injected
  snapshots      Volume snapshots [aliases: snapshot]
  ssh            Open an interactive shell in an app pod (Console must be enabled for your organization: Platform → Console & SSH)
  ssh-keys       SSH public keys on your account (for stackblaze ssh --native, scp, sftp, IDEs) [aliases: ssh-key]
  status         Check platform / IaC status for your organization
  templates      App template catalog [aliases: template]
  tokens         Your API tokens [aliases: token]
  unlink         Remove the project link from this directory
  up             Deploy a folder (default: cwd): git checkout → build the repo; no git remote or --local → upload the folder; --image → run an image
  upgrade        Download and install the latest CLI binary
  variables      App environment variables [aliases: vars, var]
  volume         App extra volumes [aliases: volumes]
  waf            App Shield (per-app WAF)
  wait           Poll until an app (and its addons) are running, including a build or rollout still in progress
  whoami         Show the authenticated user and organization

Global options (on every command that uses them; --api-url, --token, --org and -y also before the command):
  --api-url <url>       StackBlaze API base URL (env STACKBLAZE_API_URL)
  --token <token>       API token, sb_pat_... (env STACKBLAZE_TOKEN)
  --org <slug>          Run this one command in another organization (not saved; see `orgs switch`)
  -p, --project <name>  Project (env STACKBLAZE_PIPELINE; alias --pipeline)
  -e, --env <name>      Environment, default production (env STACKBLAZE_PHASE; alias --phase)
  -a, --app <name>      App (env STACKBLAZE_APP)
  --json, -o json       Print one JSON document on stdout
  -y, --yes             Never ask for confirmation (stdin not a terminal: prompts fail instead of waiting)
  -h, --help            Print help
  -v, --version         Print version