> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brew.new/llms.txt
> Use this file to discover all available pages before exploring further.

# The Brew CLI

> Every Public API operation is now a typed terminal command, built for scripts, CI, and AI agents, with a confirmation gate for irreversible sends.

<Note>
  **August 2026** · Available on all plans.
</Note>

## What Shipped

`brew-cli` is the command-line surface of Brew. Every operation in
[Public API v1](/api-reference/api/api-introduction) has a typed command. That
covers brands, AI design generation and edits, sending and scheduling,
automations, contacts and audiences, domain verification, and analytics.

Like the [MCP server](/api-reference/mcp/overview), it's a thin layer over the
same API the dashboard uses. Same validation, same permissions, same credit
metering, same rate limits. Anything you can do in the app, you can script.

```bash theme={null}
brew install getbrew/tap/brew-cli
brew-cli login
brew-cli emails list --limit 5
```

## Three Ways to Install

Homebrew ships a self-contained binary with no runtime to manage. npm
(`npm install -g @brew.new/cli`) needs Node 20 or newer. And `npx @brew.new/cli`
runs it without installing anything, which is what you want inside CI jobs and
agent sandboxes. Every [GitHub release](https://github.com/GetBrew/brew-cli/releases)
also attaches standalone binaries for macOS, Linux, and Windows with a
`checksums.txt` alongside them.

## The Conventions

Six rules hold across every command:

* **Two output modes.** Human-readable in a terminal, exact API JSON when you
  pass `--json` or pipe the output. Data goes to stdout and progress to stderr,
  so pipes stay clean.
* **Structured inputs.** Simple values are flags. Full request bodies go through
  `--input '<json>'` or `--input -` to read stdin, and uploads through `--file`.
* **Safe by default.** Irreversible commands ask for confirmation in a terminal
  and refuse anywhere else until you pass `--yes`.
* **Retry-safe writes.** `--idempotency-key` on any create makes a retry
  [replay instead of duplicate](/api-reference/api/idempotency).
* **Pagination handled.** `--limit` and `--cursor` on every list command, or
  `--all` to follow the cursor and return every page as one result.
* **Typed errors.** Failures print the API's [error envelope](/api-reference/api/errors)
  with its stable `code` and a `requestId` for support.

## Built for Agents

Where MCP gives an agent tools over a protocol, the CLI gives any harness that
can run a shell command the same reach. And it's cheap on context.

JSON turns on by itself whenever stdout isn't a terminal, which is every agent.
Exit codes carry meaning: `0` success, `1` API or runtime error, `2` usage
error, `3` auth error, `4` confirmation required. Nothing waits on stdin unless
stdin is a real terminal, so a command can't hang a session.

The confirmation gate is the part worth knowing about. A real send, delete, or
trigger fire won't execute non-interactively. It exits `4` and hands back an
envelope instead:

```json theme={null}
{
  "confirmationRequired": true,
  "command": "brew-cli emails send",
  "summary": "Send email eml_123 as a REAL campaign to audience aud_9 now. Real recipients receive it; this cannot be undone.",
  "confirmCommand": "brew-cli emails send eml_123 --subject 'Fall sale' --audience aud_9 --domain dom_1 --yes"
}
```

Your agent shows the summary to you and runs the `confirmCommand` only after you
say yes. Test sends skip the gate, so QA stays fast while the irreversible path
stays deliberate.

For discovery, `brew-cli docs --agent` prints a JSON manifest of every command
with its flags, safety class, and the API route behind it. The repo also ships a
ready-made skill at
[`skills/brew-cli/SKILL.md`](https://github.com/GetBrew/brew-cli/blob/main/skills/brew-cli/SKILL.md).
It teaches Claude Code and compatible harnesses the whole contract in about
fifty lines.

## The Escape Hatch

New platform capabilities land in the API before they get a dedicated command.
`brew-cli api` covers the gap with a raw authenticated request that still
carries your key, brand header, and error handling:

```bash theme={null}
brew-cli api GET '/v1/analytics/sends?sendId=snd_123&include=events'
```

## Get Started

[Installation](/api-reference/cli/installation) covers all three channels, and
[Common Flows](/api-reference/cli/common-flows) has worked sequences for
launching a campaign, QA before a big send, and building a welcome automation.

## Related

* [Brew CLI](/api-reference/cli/overview)
* [Commands](/api-reference/cli/commands)
* [Use from AI Agents](/api-reference/cli/agents)
* [API Introduction](/api-reference/api/api-introduction)
