# CLI Reference

Source: https://molted.email/docs/cli

Every molted command, generated from the CLI itself: arguments, options and the agent context each command prints with --help.

`@molted/cli` is the agent-facing command line for Molted. It wraps the API: it stores credentials, adds the `Authorization` header and your tenant ID to every request, and prints JSON.

```bash
npm install -g @molted/cli
molted --version
```

Every page in this section is generated from the CLI's own help text (`molted <command> --help`), so it matches the published package built from the same source. For a guided first run, see [CLI Quickstart](https://molted.email/docs/cli-quickstart.md).

## Global options

Global options go before the command (`molted --profile work send ...`).

| Option | Description | Default |
| - | - | - |
| `-V, --version` | output the version number | |
| `--base-url <url>` | Override API base URL | |
| `--mailbox-url <url>` | Override mailbox gateway URL (for agent endpoints) | |
| `--profile <name>` | Use a named profile for credentials | |
| `--skill` | Print the full agent skill reference (skill.md) and exit | |

## Agent context

Molted Email is an agent-native email control plane. The `molted` CLI handles authentication, headers, and tenant ID injection automatically so you can interact with the API using simple commands instead of raw HTTP calls.

After install (`npm install -g @molted/cli`), the `molted` binary is available in your PATH. Verify with: `molted --version`

### Quick start (3 steps)

```bash
molted auth signup --name "My Agent" --email <your human's email> --password <password>
# → credentials stored in ~/.molted/profiles/default.json automatically
# → your human's own email gets them a take-over email for Free. No address
#   for them? Use one on example.com (it reaches no one) and login-link gives
#   you a claim link instead. See `molted auth signup --help`.

molted billing setup --plan solo
# → returns { "url": "https://checkout.stripe.com/...", "plan": "solo" }
# → sends are blocked until billing is active (trial_not_activated)

molted send --to alice@example.com --template _default \
  --dedupe-key "hello-alice-1" --payload '{"subject":"Hello","html":"Hi!","text":"Hi!"}'
# → { "status": "queued", "requestId": "..." }
```

### If you already have an API key (mm\_live\_...), skip signup

```bash
molted auth init --key mm_live_xxx
```

### To join an existing tenant as a new agent

```bash
molted adopt claim <token>       # if you have an invite token (ma_inv_...)
molted adopt request             # device flow (owner approves in the portal)
```

### Output format

- Success (exit 0): JSON to stdout
- Error (exit 1): JSON to stderr, \{ "error": "message", "detail"?: ... }
- Policy-blocked sends return exit 0 with "status": "blocked", so always check status
- `molted doctor` has its own exit codes (0 ready, 1 blocker found, 2 not fully verified)

* **Credentials:** `~/.molted/profiles/<profile>.json` (auto-created, mode 0600)
* **Config dir override:** `MOLTED_CONFIG_DIR` env var
* **API key override:** `MOLTED_API_KEY` env var (with `MOLTED_TENANT_ID` also set, the credentials file is not read at all)
* **Tenant override:** `MOLTED_TENANT_ID` env var
* **Profile override:** `--profile` flag > `MOLTED_PROFILE` env var > active\_profile file > "default"
* **Base URL override:** `--base-url` flag > `MOLTED_BASE_URL` env var > credentials file > [https://api.molted.email](https://api.molted.email)
* **Mailbox URL override:** `--mailbox-url` flag > `MOLTED_MAILBOX_URL` env var > credentials file > [https://mailbox.molted.email](https://mailbox.molted.email) (when the base URL is the default; otherwise the base URL)

Every request goes to the mailbox URL, `auth signup`, `auth login`, `auth init`, `adopt claim` and `adopt request` included. Those five replace the stored profile, so they ignore its stored mailbox\_url and use `--mailbox-url` / `MOLTED_MAILBOX_URL`, else the public mailbox host for the default base URL, else the base URL you pass.

Run `molted <command> --help` for detailed context on any command. Run `molted --skill` to print the full agent skill reference.\
Full reference: [https://molted.email/cli-skill.md](https://molted.email/cli-skill.md)

## Commands

| Command | Description |
| - | - |
| [`molted adopt`](https://molted.email/docs/cli/adopt.md) | Agent adoption flows (invite & device) |
| [`molted agents`](https://molted.email/docs/cli/agents.md) | Multi-agent coordination |
| [`molted alerts`](https://molted.email/docs/cli/alerts.md) | Manage alert destinations |
| [`molted analytics`](https://molted.email/docs/cli/analytics.md) | Sending analytics and contact insights |
| [`molted approvals`](https://molted.email/docs/cli/approvals.md) | List send approvals and withdraw your own pending send |
| [`molted attachments`](https://molted.email/docs/cli/attachments.md) | Manage email attachments |
| [`molted auth`](https://molted.email/docs/cli/auth.md) | Authentication commands |
| [`molted billing`](https://molted.email/docs/cli/billing.md) | Billing and plan management |
| [`molted budget`](https://molted.email/docs/cli/budget.md) | Check remaining send quota across monthly, daily and hourly windows |
| [`molted capture`](https://molted.email/docs/cli/capture.md) | Capture an email address - upsert contact, subscribe to list, and optionally send confirmation |
| [`molted classify`](https://molted.email/docs/cli/classify.md) | Classify an inbound email the way the inbound pipeline would (platform label, safety verdict, route) |
| [`molted consent`](https://molted.email/docs/cli/consent.md) | Manage recipient consent records |
| [`molted contacts`](https://molted.email/docs/cli/contacts.md) | Manage contacts |
| [`molted doctor`](https://molted.email/docs/cli/doctor.md) | Can this key send yet, and why isn't mail flowing? Renders GET /v1/agent/setup plus the after-send checks. Exit code: 1 if any blocker is found (not ready to send); otherwise 2 if any check could not be fully verified; otherwise 0 -- 0 means ready to send and every check fully verified, safe to gate a script on. |
| [`molted domains`](https://molted.email/docs/cli/domains.md) | Manage sending domains |
| [`molted events`](https://molted.email/docs/cli/events.md) | View message event timelines |
| [`molted experiments`](https://molted.email/docs/cli/experiments.md) | Run A/B or holdout experiments on journey steps |
| [`molted feedback`](https://molted.email/docs/cli/feedback.md) | Tell the Molted team about a problem, a missing feature or a question |
| [`molted humanizer`](https://molted.email/docs/cli/humanizer.md) | Manage email humanizer configuration |
| [`molted inbound-hooks`](https://molted.email/docs/cli/inbound-hooks.md) | Manage inbound webhook mappings for zero-code integrations |
| [`molted incidents`](https://molted.email/docs/cli/incidents.md) | List and acknowledge/resolve ops incidents |
| [`molted journeys`](https://molted.email/docs/cli/journeys.md) | Manage journey orchestration |
| [`molted labels`](https://molted.email/docs/cli/labels.md) | Define labels and apply them to threads (your own business categories, per mailbox) |
| [`molted listen`](https://molted.email/docs/cli/listen.md) | Connect to the SSE event stream — persistent event loop for agents |
| [`molted lists`](https://molted.email/docs/cli/lists.md) | Manage email lists and send broadcasts |
| [`molted mailboxes`](https://molted.email/docs/cli/mailboxes.md) | Manage mailboxes |
| [`molted messages`](https://molted.email/docs/cli/messages.md) | Retrieve message data |
| [`molted next-action`](https://molted.email/docs/cli/next-action.md) | Get the next best action for a contact |
| [`molted outcomes`](https://molted.email/docs/cli/outcomes.md) | Track and query outcomes |
| [`molted overrides`](https://molted.email/docs/cli/overrides.md) | Human-in-the-loop overrides |
| [`molted pause`](https://molted.email/docs/cli/pause.md) | Pause your entire account (blocks all sends across every mailbox) |
| [`molted record-inbound`](https://molted.email/docs/cli/record-inbound.md) | Record an inbound email |
| [`molted resume`](https://molted.email/docs/cli/resume.md) | Resume a paused account (usually a human decision) |
| [`molted rules`](https://molted.email/docs/cli/rules.md) | Manage mailbox rules for automated thread routing |
| [`molted safety`](https://molted.email/docs/cli/safety.md) | Manage tenant safety settings |
| [`molted search`](https://molted.email/docs/cli/search.md) | Search your threads by subject, the other party's address or name, an attachment filename (fuzzy, typo tolerant), or whole words in the messages |
| [`molted segments`](https://molted.email/docs/cli/segments.md) | Manage audience segments |
| [`molted send`](https://molted.email/docs/cli/send.md) | Send an email via the agent API |
| [`molted settings`](https://molted.email/docs/cli/settings.md) | Manage tenant settings (cooldown, consent enforcement, etc.) |
| [`molted suppressions`](https://molted.email/docs/cli/suppressions.md) | Manage email suppressions and suppressed domains |
| [`molted team-addresses`](https://molted.email/docs/cli/team-addresses.md) | List, add and remove verified team addresses (sends to them are free) |
| [`molted templates`](https://molted.email/docs/cli/templates.md) | Manage email templates |
| [`molted threads`](https://molted.email/docs/cli/threads.md) | Manage email threads |
| [`molted timeline`](https://molted.email/docs/cli/timeline.md) | Get the delivery event timeline for a send request |
| [`molted trace`](https://molted.email/docs/cli/trace.md) | Get the full decision trace for a send request |
| [`molted update`](https://molted.email/docs/cli/update.md) | Update the Molted CLI to the latest version |
| [`molted webhooks`](https://molted.email/docs/cli/webhooks.md) | Manage webhook endpoints for real-time event notifications |
