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.

bash
npm install -g @stack0/cli
# or
bun add -g @stack0/cli
# Or run it without installing
npx @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.

bash
stack0 auth login # device flow, opens the browser
stack0 auth login --api-key sk_live_... # save a key instead
export STACK0_API_KEY=sk_live_... # per-shell, nothing written to disk
stack0 auth whoami # active identity, key masked
stack0 auth status # auth + config summary and config path
stack0 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

bash
# Send a plain-text email
stack0 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 out
stack0 cdn upload ./logo.png --folder brand --project my-project
stack0 cdn transform asset_123 --width 400 --format webp
# Capture a page, or queue it and return a job ID immediately
stack0 screenshots capture https://example.com --full-page --format webp
stack0 screenshots capture https://example.com --no-wait
# Schema-driven extraction
stack0 extraction extract https://example.com/product \
--mode schema --schema @./product-schema.json
# Run a workflow
stack0 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.

bash
stack0 mail list --json | jq '.[].id'

Commands

Run stack0 <command> --help for the current options on any command.

CommandSubcommands
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.
--jsonRaw JSON instead of formatted tables. Use this for scripting.
--verboseVerbose output.
--no-colorDisable 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.

typescript
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.