# molted capture

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

Capture an email address - upsert contact, subscribe to list, and optionally send confirmation

## Agent context

Capture is a single-call lead capture action for landing pages and forms. It upserts the contact, subscribes them to a list, and optionally sends a confirmation email -- all in one command.

### Basic capture (no confirmation email)

```bash
molted capture --email alice@example.com --list early-access --name "Alice"
# -> { "status": "success", "message": "Contact captured (silent - no email sent).",
#      "data": { "contactId": "<uuid>", "listId": "<uuid>", "subscriptionStatus": "active",
#                "emailStatus": null, "requestId": null } }
```

With confirmation email (sent with the \_default template; `--subject` needs `--body` or `--text`):

```bash
molted capture --email alice@example.com --list early-access \
  --subject "You're on the list!" --body "<p>Thanks for signing up!</p>"
# -> { "status": "success", ..., "data": { ..., "subscriptionStatus": "active",
#      "emailStatus": "queued", "requestId": "<uuid>" } }
```

### With double opt-in (new lists only)

```bash
molted capture --email alice@example.com --list waitlist --double-opt-in
# -> creates the list with doubleOptIn enabled; subscription stays "pending"
#    until the confirmation link is clicked. The link is only emailed if you
#    have an active journey triggered on the list.subscribe.pending event.
# -> if the list already exists, its doubleOptIn setting is used (flag has no effect)
```

### Attribution tagging

```bash
molted capture --email alice@example.com --list product-launch \
  --source form --tags "homepage,hero-cta" --metadata '{"campaign": "spring-2026"}'
```

### Key behaviors

- `--list` creates the list if it does not exist (uses slug as name)
- Existing contacts are updated (upsert), not duplicated
- An address already unsubscribed from the list stays unsubscribed ("subscriptionStatus": "unsubscribed") and gets no confirmation email
- `--source` defaults to "api"
- Capturing the same `--email`/--list with `--subject` twice reuses the same confirmation dedupe key, so the second call reports "emailStatus": "blocked" (an underlying duplicate) with the ORIGINAL requestId, not a new email
- Use capture instead of contacts sync + lists subscribe separately when you want the atomic single-call pattern with optional confirmation

## Commands

### molted capture

Capture an email address - upsert contact, subscribe to list, and optionally send confirmation

```bash
molted capture [options]
```

| Option | Description | Default |
| - | - | - |
| `--email <email>` | Recipient email address (required) (required) | |
| `--list <list>` | List slug to subscribe to (creates list if it does not exist) (required) (required) | |
| `--subject <subject>` | Confirmation email subject (needs `--body` or `--text`; if omitted, no email is sent) | |
| `--body <body>` | Email HTML body (used when `--subject` is set) | |
| `--text <text>` | Email plaintext body | |
| `--name <name>` | Contact display name | |
| `--tags <tags>` | Comma-separated tags (e.g. early-access,landing-page) | |
| `--double-opt-in` | Require double opt-in confirmation | |
| `--source <source>` | Attribution source: form, api, import, manual | `api` |
| `--metadata <json>` | Arbitrary JSON metadata | |

See [CLI overview](https://molted.email/docs/cli.md) for global options, credentials and output format.
