Skip to Content
CLI & APICommand reference

stackblaze api

Call any StackBlaze API endpoint with your stored auth and print the JSON response

Usage: stackblaze api [options] <method> <path>

Call any StackBlaze API endpoint with your stored auth and print the JSON
response

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)
  -d, --data <json>        Request body: JSON, @file, or @- (stdin)
  -q, --query <key=value>  Query parameter (repeatable)
  -o, --output <format>    Output format: text or json (choices: "text",
                           "json")
  -h, --help               Print help

<path> is /api/… (a path without a leading slash gets /api/ prepended).
The response body is printed whatever the status. Exit code: 0 for 2xx,
2 for 401, 3 for 402/403 (refused by plan or role), 1 otherwise.

Examples:
  $ stackblaze api GET /api/pipelines
  $ stackblaze api GET audit -q limit=5
  $ stackblaze api POST /api/pipelines/demo/phases --data '{"name":"staging"}'
  $ stackblaze api PATCH /api/tenants/<id> --data @org.json

Example

Call an endpoint the CLI has no command for, with your saved sign-in. Here: which platform features are switched on:

stackblaze api GET /api/features
{
  "functions": true,
  "sandboxes": true,
  "logDrains": true,
  "previews": true,
  "volumeSnapshots": true,
  "databaseBackups": true,
  "databasePublicAccess": true,
  "fileBrowser": true,
  "iac": true,
  "tracing": true,
  "aiModels": true,
  "aiAgents": true
}

The body is printed whatever the status, and the exit code says how it went (1 for a 404):

stackblaze api GET /api/pipelines/no-such-project; echo "exit $?"
{
  "message": "Pipeline not found: no-such-project",
  "error": "Not Found",
  "statusCode": 404
}
x  HTTP 404: Pipeline not found: no-such-project
exit 1

On this page