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

# CLI

> @drin00/cli — the drin command line. Send mail, manage domains, inboxes, contacts, templates and webhooks, read metrics, and launch the MCP server, all from your terminal.

`@drin00/cli` is the drin command line — full parity with the dashboard. Send mail, manage domains, inboxes, contacts, templates and webhooks, read delivery metrics, and launch the MCP server for AI agents, all from your terminal. Zero third-party dependencies; Node 20+.

## Install

Install it globally for a `drin` command, or run it ad hoc with `npx` — no install required:

```bash Install theme={null}
npm i -g @drin00/cli      # then: drin --help
# or run ad hoc:
npx @drin00/cli emails list
```

## Authenticate

The CLI authenticates with a single API key. Set it once in your environment — create one in the dashboard under **Settings → API Keys**. If the key is account-wide rather than scoped to one project, also set `DRIN_SENDER` to a project `externalId`.

```bash Environment theme={null}
export DRIN_API_KEY=drin_your_key      # Settings → API Keys in the dashboard
export DRIN_SENDER=your-product        # only for account-wide keys
# optional: export DRIN_BASE_URL=https://api.drin.run
```

Every value can also be passed per-command with `--api-key`, `--sender`, and `--base-url`, which override the environment:

```bash Per-command flags theme={null}
drin emails list \
  --api-key drin_your_key \
  --sender your-product \
  --base-url https://api.drin.run
```

## Send mail

The `send` command takes a verified `--from` address, one or more `--to` recipients, and a body (`--text`, `--html`, or a `--template-id`). It also accepts `--data`, `--header`, `--tag`, `--attach`, and `--cc` / `--bcc`.

```bash drin send theme={null}
# One recipient
drin send --from "Acme <hi@acme.com>" --to you@example.com \
  --subject "Hello" --text "It works"

# Several recipients (repeat --to, or comma-separate)
drin send --from hi@acme.com --to a@x.com --to b@y.com --html "<p>hi</p>"

# Merge variables + an attachment
drin send --from hi@acme.com --to you@example.com \
  --template-id tmpl_123 --data '{"name":"Ada"}' --attach invoice.pdf
```

## Read mail & logs

The `emails` group lists and inspects messages in either direction. Pass `--direction inbound` to see received mail, and `body` / `attachments` to pull the full content.

```bash Activity theme={null}
drin emails list --direction inbound --limit 10
drin emails get <id>
drin emails body <id>
drin emails attachments <id>
```

## Domains

```bash drin domains theme={null}
drin domains list --status verified
drin domains add mail.acme.com            # prints the DNS records to publish
drin domains verify <id>                  # re-check verification now
drin domains receiving <id> --enabled true  # turn on inbound (prints the MX)
```

## Inbound & conversations

Create an inbox on a receiving domain, read its threads, reply in-thread, and simulate inbound mail to test the pipeline without DNS:

```bash Inbox loop theme={null}
drin inboxes create --address support --domain-id <id>
drin threads list --inbox-id <id>
drin emails reply <message-id> --text "On it — thanks!"
drin inbound simulate --to support@acme.com --from "C <c@x.com>" \
  --subject Hi --text yo
```

## Everything else

Contacts, suppressions, templates, webhooks, API keys, metrics, and the cross-product account feed are all here too:

```bash Account surface theme={null}
drin contacts create --email a@x.com --first-name Ada
drin suppressions add someone@example.com
drin templates create --name Welcome --subject "Hi {{name}}" --html-file welcome.html
drin webhooks create --url https://acme.com/hook --event delivery --event bounce
drin apikeys create --name "CI deploy"
drin metrics --from 2026-05-01 --to 2026-05-31
drin account messages --limit 20          # every product in the account
```

## JSON output

Add `--json` to any command to print the raw API response instead of a formatted table — exactly what a tool-using agent or a CI script wants:

```bash --json theme={null}
# Human-readable table (default)
drin domains list

# Raw API JSON — pipe it into jq, an agent, or a script
drin domains list --json | jq '.data[].name'
```

<Tip>
  **Discover any command.** Run `drin --help` for the full command list, or `drin <group> --help` (e.g. `drin domains --help`) for the flags and subcommands of a single group.
</Tip>

## Command reference

| Group          | Subcommands                                                                 |
| -------------- | --------------------------------------------------------------------------- |
| `send`         | — (supports `--data`, `--header`, `--tag`, `--attach`, `--template-id`)     |
| `emails`       | `list`, `get`, `body`, `attachments`, `reply`, `batch`                      |
| `domains`      | `list`, `get`, `add`, `verify`, `delete`, `receiving`                       |
| `inboxes`      | `list`, `create`, `get`, `delete`                                           |
| `threads`      | `list`, `get`                                                               |
| `contacts`     | `list`, `create`, `get`, `update`, `unsubscribe`, `resubscribe`, `delete`   |
| `suppressions` | `list`, `add`, `remove`                                                     |
| `templates`    | `list`, `get`, `create`, `update`, `delete`, `render`, `preview`, `gallery` |
| `webhooks`     | `list`, `get`, `create`, `update`, `delete`                                 |
| `apikeys`      | `list`, `create`, `revoke`                                                  |
| `inbound`      | `simulate`                                                                  |
| `integrations` | `list`, `get`, `install`, `update`, `uninstall`                             |
| `account`      | `messages` (tenant-wide, every product)                                     |
| `metrics`      | —                                                                           |
| `mcp`          | runs `@drin00/mcp` over stdio with your resolved env                        |

## Launch the MCP server

The CLI bundles the [MCP server](/agents/mcp). `drin mcp` launches `@drin00/mcp` over stdio using the same resolved environment — point an AI client at it and your agent gets all 54 tools:

```bash drin mcp theme={null}
drin mcp
```

<Card title="Give an agent the tools" icon="plug" href="/agents/mcp">
  The MCP server exposes the whole API as 54 tools — one command, one key.
</Card>
