CLI & CI

CLI & CI

Deploy from your terminal or a CI job with the stackblaze CLI, or call the same API the dashboard uses.

Install the CLI

The installers download a standalone binary. No Node.js is needed, and there is no npm package.

macOS / Linux
curl -fsSL https://stackblaze.com/install.sh | sh
Windows PowerShell
irm https://stackblaze.com/install.ps1 | iex
Homebrew
brew tap stackblaze/tap && brew install stackblaze

If Homebrew refuses to load the formula from an untrusted tap, run brew trust --tap stackblaze/tap once and install again. Update installer-managed binaries with stackblaze upgrade and Homebrew installs with brew upgrade stackblaze.

Sign in and deploy

terminal
stackblaze login     # one-click browser sign-in
stackblaze init      # create a project and link this directory
stackblaze up        # create the app and stream the build
stackblaze logs -f   # follow the app's logs
stackblaze open      # open the app's dashboard page

up picks the source from the folder you run it in:

FolderWhat up does
Git checkout with a remoteBuilds the remote repository and current branch, not local files. Push your commits first.
No git remote, or --localUploads the folder (honouring .gitignore; .git, node_modules and .env files are left out) and builds it.
--image nginx:1.27Deploys a Docker image without building.

Run up again to ship changes: it updates the existing app and deploys again. Add --wait to wait until the new version is running.

Tip

On a server or over SSH, use stackblaze login --browserless. With an API token, use stackblaze login --token kbr_pat_…. Create tokens in the dashboard under Settings → API tokens, or with stackblaze tokens create ci --expires 90d. If you belong to several organizations, stackblaze orgs switch <slug> changes the one your login acts in, and --org <slug> runs one command in another.

Deploy from CI

In CI, skip login and set the token and scope as environment variables. stackblaze up is safe to re-run, so the same command works on every push: the first run creates the app, later runs update it and build again. With --ci it streams the build as NDJSON, and the job fails when the build fails.

GitHub Actions

.github/workflows/deploy.yml
name: Deploy
on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    env:
      STACKBLAZE_API_URL: https://api.stackblaze.cloud
      STACKBLAZE_TOKEN: ${{ secrets.STACKBLAZE_TOKEN }}
      STACKBLAZE_PIPELINE: my-project
      STACKBLAZE_PHASE: production
      STACKBLAZE_APP: web
    steps:
      - uses: actions/checkout@v4
      - name: Install StackBlaze CLI
        run: |
          curl -fsSL https://stackblaze.com/install.sh | sh
          echo "$HOME/.local/bin" >> "$GITHUB_PATH"
      - name: Deploy
        run: stackblaze up --ci --wait

Keep the actions/checkout step: up reads the repository and branch from the checkout, and builds exactly the pushed commit (the pull request's head commit on pull_request events). The very first build of a brand-new app uses the head of the branch. --wait also waits up to 10 minutes for the new version to be running; drop it to finish when the build succeeds.

For an image app, run stackblaze up --ci --wait --image registry.example.com/acme/web --tag "$GITHUB_SHA". If the app already auto-deploys on push from GitHub, you do not need this workflow.

Exit codes

CodeMeaning
0Success
1Usage or validation error, failed build or deploy, an app that did not become ready, or a declined confirmation
2Missing or invalid credentials (no token, HTTP 401, wrong password)
3The API refused or failed the request (any other 403, 402 upgrade required, API or network error, timeout)

Destructive commands ask for confirmation. Without a terminal the prompt gets no answer and the command exits 1 without changing anything, so pass -y in scripts. See the CLI reference for every command, flag and example.

Without the CLI: REST API

Everything the CLI does goes through the REST API at https://api.stackblaze.cloud. Send the same kbr_pat_ token as a Bearer header. Interactive OpenAPI is at /api/docs.

terminal
export STACKBLAZE_TOKEN=kbr_pat_…

curl -sS https://api.stackblaze.cloud/api/pipelines \
  -H "Authorization: Bearer $STACKBLAZE_TOKEN"

# or, with your stored CLI login
stackblaze api GET /api/pipelines

To apply a stackblaze.yaml blueprint from CI, see Blueprint.

MCP

Point an MCP client at https://mcp.stackblaze.cloud/mcp and pass your token in Authorization, or run stackblaze setup agent -y to configure every editor it detects. stackblaze setup mcp --ide <name> configures one: Cursor, Claude Code, Codex, VS Code (Copilot), Windsurf or OpenCode; add --print to print the snippet instead. Tool names are unprefixed (get_app, deploy_app, search_logs). See MCP Server for every client.