CLI

Reference

CLI

7 min readUpdated August 2026

stackblaze is the official command-line client: deploy from your terminal, tail logs, manage apps and add-ons, and keep your whole project as code. It is a thin client over the same authenticated, tenant-scoped REST API the dashboard uses, so it can never do more than your kbr_pat_ token is allowed to.

terminal

# Install the standalone binary (no Node.js required)

$ curl -fsSL https://stackblaze.com/install.sh | sh

# One-click browser sign-in

$ stackblaze login

# Create a pipeline, link this directory, deploy it

$ stackblaze init -y && stackblaze up

Install & authenticate

curl -fsSL https://stackblaze.com/install.sh | shInstall the standalone binary to ~/.local/bin — no Node.js required. Or: npm install -g @stackblaze/cli (Node 18+).
stackblaze loginOne-click browser sign-in. For CI, pass --token kbr_pat_… or set STACKBLAZE_TOKEN.
stackblaze whoamiShow the authenticated user and pipeline count.
stackblaze contextShow the resolved API URL and scope.
stackblaze upgradeSelf-update to the latest release.

Projects and apps

stackblaze init [-y]Create a pipeline and link the current directory in one step.
stackblaze link / unlinkLink the cwd to a pipeline, phase, and app (writes .stackblaze/project.json).
stackblaze pipelines list|create|deleteManage pipelines (projects).
stackblaze phases list|create|deleteManage phases (environments); switch defaults with phase use <name>.
stackblaze apps list|get|create|update|deleteManage apps: spec, status, pods, branch, image, port, pod size, domain.
stackblaze openPrint the dashboard URL for the linked pipeline or app.

Deploy

stackblaze upDeploy the cwd; streams build logs. --path for monorepos, --ci for NDJSON output, --detach to skip streaming, --wait to poll until running.
stackblaze builds list|trigger|logsList, trigger, or stream git build jobs.
stackblaze deployments list|rollbackList builds or roll back to a prior image tag.
stackblaze apps restart|redeploy|scaleRolling restart, redeploy (optional --tag), or scale replicas (--replicas 0 pauses).
stackblaze downPause the app (scale web to 0).
stackblaze templates search|deployBrowse the template catalog or deploy a template by name.
stackblaze inspect [url]Deployment plan from the cwd or a public git URL.
terminal

stackblaze init creates and links the project; stackblaze up builds from git and streams the rollout.

Observe & debug

stackblaze logs [-f] [--search]App logs: -f streams live over WebSocket; --search queries history (-q, --level, --minutes).
stackblaze metrics / eventsCPU and memory snapshot; recent Kubernetes events.
stackblaze diagnosePerformance diagnosis with findings and hints.
stackblaze sshInteractive shell in the app pod over a WebSocket console.
stackblaze run <cmd> / shellRun a local command (or open a subshell) with the remote app env injected.
stackblaze env pullWrite remote env vars to .env.local.
stackblaze connect postgresOpen a database or Redis client in the app pod (--local optional).
stackblaze audit / billingWho did what and when; plan, usage credit, and resource breakdown.

Add-ons, variables, domains

stackblaze addons list|add|deleteBrowse the catalog, attach an add-on to the linked app, or detach it (-y).
stackblaze variables list|set|deleteManage environment variables (delete supports -y).
stackblaze snapshots list|create|restoreVolume snapshots; restore asks for confirmation.
stackblaze domain [add]List or set custom domains on the app.

Infrastructure as Code

stackblaze export [--out DIR]Write current pipelines and apps as YAML manifests — the easiest way to author them.
stackblaze plan <path>Show what apply would create or change. No writes.
stackblaze apply <path>Create or update the declared resources. Idempotent.
stackblaze destroy <path>Delete the declared resources (asks for confirmation; -y to skip).
stackblaze statusPlatform and IaC status — IaC is opt-in per organization.
terminal

export pulls the live project down as YAML; plan shows the diff and apply is idempotent.

AI agent & MCP

stackblaze agent [-p "…"]Chat with the StackBlaze agent in your terminal — interactive REPL, one-shot with -p, or --json for scripting. Scope with --pipeline, --phase, --app.
stackblaze setup mcpWire the StackBlaze MCP server into Cursor or Claude.
terminal

The agent uses the same tools as the dashboard chat: it reads your apps and logs, then proposes the fix.

CI and exit codes

stackblaze up --ci -yNon-interactive deploy: streams NDJSON build events (deploy, build, log, status, error) and exits when the build finishes.
exit 0 / 1 / 2 / 3Success / usage, validation, or build failure / missing or invalid credentials / StackBlaze API error.
-y, --yesSkips confirmation on destructive commands (apps delete, pipelines delete, destroy, snapshots restore, down, variables delete).

CI/CD

Store STACKBLAZE_TOKEN (and STACKBLAZE_API_URL) as CI secrets, install with the one-liner, then stackblaze up --ci -y deploys without prompts and fails the job on build failure. Precedence is flags, then environment, then the saved config from stackblaze login.