Stack0 CLI
Drive every Stack0 product from the terminal: send email, upload to the CDN, capture screenshots, extract structured data, run AI workflows, and call integrations. Published on npm as @stack0/cli, installed as the stack0 binary.
Install
Requires Node.js 18 or newer.
npm install -g @stack0/cli# orbun add -g @stack0/cli# Or run it without installingnpx @stack0/cli --help
Authenticate
The interactive device flow opens your browser. If you already have an API key, or you are running in CI, pass it directly instead.
stack0 auth login # device flow, opens the browserstack0 auth login --api-key sk_live_... # save a key insteadexport STACK0_API_KEY=sk_live_... # per-shell, nothing written to diskstack0 auth whoami # active identity, key maskedstack0 auth status # auth + config summary and config pathstack0 auth logout # clear stored credentials
Each value resolves in this order: command-line flag, then environment variable, then saved config. See Authentication for how keys are scoped.
Examples
# Send a plain-text emailstack0 mail send --from you@yourdomain.com --to user@example.com \--subject "Welcome" --text "Thanks for signing up!"# Send HTML from a file — prefix the path with @stack0 mail send --from you@yourdomain.com --to user@example.com \--subject "Welcome" --html @./welcome.html# Upload to the CDN and transform on the way outstack0 cdn upload ./logo.png --folder brand --project my-projectstack0 cdn transform asset_123 --width 400 --format webp# Capture a page, or queue it and return a job ID immediatelystack0 screenshots capture https://example.com --full-page --format webpstack0 screenshots capture https://example.com --no-wait# Schema-driven extractionstack0 extraction extract https://example.com/product \--mode schema --schema @./product-schema.json# Run a workflowstack0 workflows run wf_123
Scripting
Every command accepts --json and writes machine-readable output to stdout, so an agent or a shell script can pipe it straight into a parser.
stack0 mail list --json | jq '.[].id'
Commands
Run stack0 <command> --help for the current options on any command.
| Command | Subcommands |
|---|---|
auth Sign in, sign out, and inspect the active identity. | login · logout · whoami · status |
config Saved defaults: API key, project, environment, base URL. | set · get · reset |
mail Send email, manage domains, templates, contacts, audiences, campaigns, and sequences. | send · list · get · resend · cancel · analytics · domains · templates · contacts · audiences · campaigns · sequences · events |
cdn Upload and manage assets, folders, video, private files, bundles, and imports. | upload · list · get · update · delete · delete-many · move · transform · usage · folders · video · private · bundles · imports |
screenshots Capture webpages as images or PDFs, in one shot or on a schedule. | capture · list · get · delete · batch · schedules |
extraction Pull Markdown or schema-driven JSON out of any webpage. | extract · list · get · delete · batch · usage · schedules |
workflows Create, run, and inspect multi-step AI workflows. | create · list · get · update · delete · run · runs |
integrations Connect and call third-party services on a user's behalf. | connectors · connections · stats · logs · crm · storage · communication · productivity |
marketing Trends, content, scripts, analytics, and the content calendar. | trends · opportunities · content · scripts · analytics · calendar · settings · usage |
Global options
| --api-key <key> | API key for this invocation. |
| -p, --project <id> | Project to act on. |
| -e, --env <env> | sandbox or production. |
| --json | Raw JSON instead of formatted tables. Use this for scripting. |
| --verbose | Verbose output. |
| --no-color | Disable colored output. |
| --base-url <url> | Override the API base URL. |
In your own code
The CLI is a thin wrapper over the SDK. Inside an application, call the SDK directly.
import Stack0 from "@stack0/sdk";const stack0 = new Stack0({ apiKey: process.env.STACK0_API_KEY });await stack0.mail.send({ from, to, subject, text });
Package: npmjs.com/package/@stack0/cli. Source: github.com/stack0dev/cli. MIT licensed.