# Outbound

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

Send and reply to email from a specific mailbox using the mailbox-scoped outbound API.

The outbound API is the mailbox-scoped send surface used by agentic mailbox clients. It handles thread projection, canary token detection, deduplication, and [autonomy level](https://molted.email/docs/autonomy-levels.md) gating per mailbox. It forwards each send to the [agent send](https://molted.email/docs/sending-email.md#agent-send-recommended), so the same policy checks, holds and block reasons apply.

## Outbound vs. agent send

Molted provides two sending surfaces:

| Endpoint | Best for |
| - | - |
| `POST /v1/agent/request-send` | Tenant-level sends from any agent. Full policy trace, scheduled sends, attachments. |
| `POST /v1/agent/outbound/send` | Mailbox-scoped sends. Thread projection, canary detection, per-mailbox autonomy enforcement. |

Use `/v1/agent/outbound/send` when your agent acts on behalf of a specific mailbox and you want thread continuity and per-mailbox autonomy controls. Use `/v1/agent/request-send` for general-purpose tenant-level sends.

See [Sending Email](https://molted.email/docs/sending-email.md) for full documentation on the agent send endpoint.

## Endpoints

| Method | Path | Description |
| - | - | - |
| POST | `/v1/agent/outbound/send` | Send an email from a mailbox |
| POST | `/v1/agent/outbound/reply` | Reply to an existing thread |
| POST | `/v1/agent/outbound/schedule-followup` | Schedule a followup if no reply is received |
| DELETE | `/v1/agent/followups/:id` | Cancel a pending followup |

All endpoints require [Bearer authentication](https://molted.email/docs/authentication.md) and the `automation` API key scope, plus `send` on the mailbox the email goes out from. Every path that targets a thread, or a contact a human has taken over in the sending mailbox, answers `409 thread_taken_over` (an idempotent retry of a send made before the take-over still gets its original result).

## Send

Send a new email from a mailbox. Creates a new thread if no matching thread exists.

```
POST https://mailbox.molted.email/v1/agent/outbound/send
```

```bash title="curl"
curl -X POST "https://mailbox.molted.email/v1/agent/outbound/send" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "recipientEmail": "alice@example.com",
    "templateId": "welcome",
    "dedupeKey": "welcome-alice-1",
    "payload": { "name": "Alice" },
    "mailboxId": "MAILBOX_UUID"
  }'
```

### Request body

| Field | Type | Required | Description |
| - | - | - | - |
| `recipientEmail` | string | Yes | Recipient email address (a malformed address is a `400`) |
| `templateId` | string | Yes | Template ID to use for the send (`_default` for inline content) |
| `dedupeKey` | string | Yes | Unique key to prevent duplicate sends. A second call with the same key sends nothing (see [Deduplication](#deduplication)). |
| `payload` | object | Yes | Template variables, or `subject`/`html`/`text` for `_default` |
| `mailboxId` | string (UUID) | No | Send from a specific mailbox. Enables per-mailbox autonomy level enforcement. Omitted, the thread's mailbox or your default mailbox is used. |
| `threadId` | string (UUID) | No | Associate with an existing thread. The thread's own mailbox must be in your key's scope, and the send goes out from it: a different `mailboxId` is `400 thread_mailbox_mismatch`. |
| `subject` | string | No | Subject line for the email. Used by the `_default` template (or as a fallback if `payload.subject` is set); ignored by a named template, which renders its own subject. |
| `sendReason` | string | No | Reason for sending, recorded in the decision trace |
| `idempotencyKey` | string | No | Alternative deduplication key |
| `humanize` | boolean | No | `false` sends exactly as written; `true` asks for the [humanizer](https://molted.email/docs/humanizer.md#precedence) |
| `humanizeStyle` | string | No | `casual`, `professional` or `friendly` |
| `humanizePreviewId` | string | No | Send exactly a [previewed rewrite](https://molted.email/docs/humanizer.md#send-exactly-what-you-previewed) |
| `replyTo` | string | No | Where the recipient's replies go: one plain address. See [Reply-To](https://molted.email/docs/sending-email.md#reply-to). |

### Response

```json title="Response"
{
  "requestId": "3f0c2a8e-...",
  "status": "queued",
  "policyTrace": { "decision": { "decision": "allow", "reason": null }, "auditEvents": [ ... ] },
  "threadProjection": { "threadId": "9b1d4c7a-...", "threadMessageId": "c2e8..." }
}
```

`threadProjection` names the thread the send was recorded in (`null` when nothing was projected, e.g. a blocked or scheduled send); `reason` and `warnings` appear as on the [agent send](https://molted.email/docs/sending-email.md#response).

Response status values:

| Status | Meaning |
| - | - |
| `queued` | Accepted, headed for delivery |
| `scheduled` | Accepted but deferred (e.g. domain warmup); check `scheduledAt` |
| `blocked` | Blocked by the policy engine; check `reason` (a same-`dedupeKey` retry comes back `blocked` with `reason: "duplicate"`, and the original `requestId`) |
| `pending_approval` | Held for a human: `reason` is `quarantined_attachment`, `autonomy_level`, `thread_risk_flagged` or `content_check` |

A `blocked` or `pending_approval` status is not an error - it means the policy engine or autonomy level is working correctly. Always check the `status` field. See [Errors & Policy Blocks](https://molted.email/docs/errors.md) for every `reason` value.

With a `threadId`, the payload is checked for a canary token first. A leaked token marks the thread (`canary_violation` in its metadata); if your [safety settings](https://molted.email/docs/safety-settings.md) block canary violations, the send is refused with `{ "requestId": null, "status": "blocked", "reason": "canary_violation" }`.

### CLI

```bash title="molted send"
# The send CLI uses /v1/agent/request-send by default
# To use the outbound endpoint, see: molted threads reply

molted send --to alice@example.com --template welcome \
  --dedupe-key "welcome-alice-1" --payload '{"name": "Alice"}' \
  --mailbox MAILBOX_UUID
```

MCP `send_email` also calls `/v1/agent/request-send`.

## Reply

Reply to an existing thread. The reply is sent from the mailbox that owns the thread.

```
POST https://mailbox.molted.email/v1/agent/outbound/reply
```

```bash title="curl"
curl -X POST "https://mailbox.molted.email/v1/agent/outbound/reply" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "threadId": "THREAD_UUID",
    "templateId": "_default",
    "dedupeKey": "reply-alice-1",
    "payload": { "text": "Thanks for reaching out - we will get back to you shortly." }
  }'
```

### Request body

| Field | Type | Required | Description |
| - | - | - | - |
| `threadId` | string (UUID) | Yes | Thread to reply to |
| `templateId` | string | Yes | Template ID. Use `_default` for a reply written inline (`payload.text`/`payload.html`). |
| `dedupeKey` | string | Yes | Unique key to prevent duplicate replies |
| `payload` | object | Yes | Template variables, or `text`/`html` for `_default`. Set `payload.subject` to override the reply subject. |
| `sendReason` | string | No | Reason for replying |
| `idempotencyKey` | string | No | Alternative deduplication key |
| `attachments` | array | No | Up to 20 `{ "id": "<attachment uuid>" }` refs; same checks as on the [agent send](https://molted.email/docs/sending-email.md#request-body) |
| `inReplyToMessageId` | string (UUID) | No | The inbound message (a `messages[].id` from `GET /v1/agent/threads/:id`) this reply answers. Defaults to the thread's latest inbound message. `404` if it is not an inbound message of this thread. |
| `humanize` | boolean | No | `false` sends exactly as written; `true` asks for the [humanizer](https://molted.email/docs/humanizer.md#precedence) |
| `humanizeStyle` | string | No | `casual`, `professional` or `friendly` |
| `humanizePreviewId` | string | No | Send exactly a [previewed rewrite](https://molted.email/docs/humanizer.md#send-exactly-what-you-previewed) (the reply's `Re:` subject is not compared) |
| `replyTo` | string | No | Where the contact's answer goes, e.g. a person you hand the conversation to: one plain address. See [Reply-To](https://molted.email/docs/sending-email.md#reply-to). |

A reply goes to the `Reply-To` of the message it answers (`inReplyToMessageId`, else the latest inbound message) only when that is an address you already wrote to in the thread, or the same company's (non-shared) domain when the message was sent from that company and passed DMARC for it; otherwise to the thread's contact. The response carries `replyRecipient` (`address`, `source`, and a `reason` when a Reply-To was not honored) next to the fields a send returns. See [who a reply goes to](https://molted.email/docs/threads.md#who-a-reply-goes-to).

With the `_default` template, a reply with no subject in `payload` defaults to `Re: <thread subject>` (never doubled if the thread's subject already starts with "Re:"); a named template renders its own subject. The reply also carries `In-Reply-To`/`References` headers, built from the contact's latest inbound message and your own earlier messages in the thread (when a Message-ID is on file for them), so mail clients (Gmail, Outlook, Apple Mail, ...) thread it into the same conversation instead of starting a new one. A reply skips the cooldown.

### CLI

```bash title="molted threads reply"
# Shorthand with plain text body -- subject defaults to "Re: <thread subject>"
molted threads reply THREAD_UUID --body "Thanks for reaching out!"

# Override the default subject
molted threads reply THREAD_UUID --body "Thanks for reaching out!" --subject "Re: Question"

# With a specific template and payload
molted threads reply THREAD_UUID \
  --template-id follow-up \
  --payload '{"name": "Alice"}' \
  --dedupe-key "reply-alice-2"

# Introduce a colleague: their answer goes to Sam, not the mailbox
molted threads reply THREAD_UUID --body "Sam will take it from here." --reply-to sam@acme.dev

# Answer a specific inbound message (its Reply-To decides where the reply goes)
molted threads reply THREAD_UUID --body "Got it." --in-reply-to-message MESSAGE_UUID
```

`molted threads reply` also takes `--html`, `--send-reason`, `--humanize`/`--no-humanize`, `--humanize-style` and `--humanize-preview`. In MCP the tool is `reply`.

## Schedule followup

Schedule a followup email that sends automatically if the contact does not reply within a specified delay.

```
POST https://mailbox.molted.email/v1/agent/outbound/schedule-followup
```

```bash title="curl"
curl -X POST "https://mailbox.molted.email/v1/agent/outbound/schedule-followup" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contactEmail": "alice@example.com",
    "threadRequestId": "REQUEST_UUID",
    "delayMinutes": 4320,
    "cancelOnReply": true
  }'
```

### Request body

| Field | Type | Required | Description |
| - | - | - | - |
| `contactEmail` | string | Yes | Contact email address |
| `threadRequestId` | string (UUID) | Yes | The `requestId` from the initial send response |
| `delayMinutes` | integer | Yes | Delay in minutes before the followup sends (1-43200, max 30 days) |
| `cancelOnReply` | boolean | No | Cancel the followup automatically if the contact replies first. Default `true`. |
| `triggerConditions` | object | No | `templateId` and `payload` choose the followup's content -- see below |

The `threadRequestId` is the `requestId` returned from the [send](#send) or [reply](#reply) response. Save this value when sending if you plan to schedule a follow-up later.

```json title="Response"
{ "followupId": "7d2f...", "status": "pending", "scheduledAt": "2026-03-04T12:00:00.000Z" }
```

The agent route `POST /v1/agent/schedule-followup` (what MCP `schedule_followup` calls) takes the same body (plus `tenantId` on `api.molted.email`), and accepts an absolute `scheduledAt` (ISO 8601, at least 60 seconds ahead) instead of `delayMinutes`: give exactly one of the two. An unknown `threadRequestId` is a `400` there.

### Choosing the content

A followup has no content of its own at schedule time -- it's rendered when it fires, from `triggerConditions`:

- `triggerConditions.templateId` names a template slug (or ID) to render. If you don't set one, it defaults to `followup-default` -- create a template with that slug in your tenant to give every followup that names no template its content.
- `triggerConditions.payload` supplies that template's variables.
- Set `templateId` to `_default` to skip template lookup and pass literal `subject`/`html`/`text` directly in `payload` instead.

```bash title="curl"
curl -X POST "https://mailbox.molted.email/v1/agent/outbound/schedule-followup" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contactEmail": "alice@example.com",
    "threadRequestId": "REQUEST_UUID",
    "delayMinutes": 4320,
    "cancelOnReply": true,
    "triggerConditions": {
      "templateId": "followup-nudge",
      "payload": { "firstName": "Alice" }
    }
  }'
```

If no template resolves (no `templateId` given and no `followup-default` template exists, or an explicit `templateId` that doesn't exist) or the template fails to render, the followup is cancelled (reason `template_not_found` or `render_failed`) rather than sent with no content.

The rendered followup gets the same outbound compliance as any send (see [System variables](https://molted.email/docs/templates.md#system-variables)): `{{unsubscribe_url}}` / `{{molted:unsubscribe_url}}` become a working per-recipient link with one-click headers, `{{physical_address}}` is filled with the workspace's physical address, and a marketing template gets the address footer. A marketing template (the type of `followup-default` unless you created it as `transactional`) while the workspace has no physical address on file cancels the followup with reason `missing_physical_address`.

### Approval hold

A followup goes through the same [autonomy level](https://molted.email/docs/autonomy-levels.md) gate as any other agent send. At level 3 it's queued and sent automatically; at level 1 (every send) or level 2 (first contact with this recipient) it's held for approval and shows up in the portal's approval queue like any other held send -- approving it sends the same content that was rendered when it fired. A followup on a thread whose inbound mail was flagged is held at any level, the same [thread-risk hold](https://molted.email/docs/autonomy-levels.md#holds-that-apply-at-every-level) a reply gets.

At the scheduled time, the follow-up is also checked against [suppressions](https://molted.email/docs/suppressions.md) and your billing plan before it sends. If the contact has since been suppressed, or your plan is trial (not yet activated) or expired, the follow-up is cancelled (reason `suppressed`, `trial_not_activated`, or `subscription_expired`, recorded in the audit trail) -- it will not silently disappear.

A follow-up sent at autonomy level 3 also counts against your [send quota](https://molted.email/docs/rate-limits.md) -- the same monthly/daily/hourly budget an API send draws from. Over the daily or hourly limit, the follow-up is deferred and retried automatically once that window resets, the same as a paused mailbox, rather than cancelled. Over the monthly limit (or its overage cap, on a plan with overage), the follow-up is cancelled with reason `monthly_limit_exceeded` or `overage_cap_exceeded`, recorded the same way as the other cancellation reasons above.

### Cancel a followup

```bash title="curl"
curl -X DELETE "https://mailbox.molted.email/v1/agent/followups/FOLLOWUP_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Answers `{ "cancelled": true }`, or `{ "cancelled": false }` when no pending followup has that id. The key needs `send` on the mailbox of the request it follows up on.

### Errors

| Status | Code | Meaning |
| - | - | - |
| 404 | `send_request_not_found` | No send request matches `threadRequestId` for this tenant. Use the `requestId` returned from the original [send](#send) or [reply](#reply) call. |
| 409 | `thread_taken_over` | A human has taken over the thread of that request, or a thread with this contact in its mailbox. |

### CLI

```bash title="molted threads followup"
# Schedule followup 72 hours after initial send
molted threads followup REQUEST_UUID \
  --contact-email alice@example.com \
  --delay-hours 72 \
  --cancel-on-reply
```

`--delay-minutes <n>` works instead of `--delay-hours`, and `--trigger-conditions '{"templateId": "followup-nudge", "payload": {"firstName": "Alice"}}'` sets the content. The CLI only sends `cancelOnReply` when you pass `--cancel-on-reply`, so the API default (`true`) applies either way. In MCP the tool is `schedule_followup` (`contact_email`, `thread_request_id`, `delay_minutes`, `cancel_on_reply`, `trigger_conditions`).

## Deduplication

Every outbound send and reply requires a `dedupeKey`. A key is used up by the first request made with it: a second call with the same key sends nothing and comes back `blocked` with `reason: "duplicate"` and the first request's `requestId`. Use deterministic keys based on your workflow, contact, and step:

```
{workflow}-{contact-id}-{step}
# e.g. "onboard-alice-day1", "renewal-alice-2026q1"
```

If you use a random key (like `molted threads reply` does when you omit `--dedupe-key`), each call is treated as a new send. MCP `reply` defaults to a hash of the reply's content instead, so an identical retry is deduplicated.

Empty or whitespace-only values (e.g. `--dedupe-key ""`) are rejected up front with a `400` (`dedupeKey must not be empty` / `must contain at least one non-whitespace character`). Silently accepting them would collapse every such send into a single "duplicate" and block all subsequent sends after the first.

## Autonomy levels

Outbound sends through a mailbox are subject to that mailbox's [autonomy level](https://molted.email/docs/autonomy-levels.md):

- **L1 (Assisted)** - Every send requires human approval. Response status: `pending_approval`.
- **L2 (Guarded Auto)** - First message to a new contact requires approval. Subsequent messages send automatically.
- **L3 (Fully Autonomous)** - All policy-approved sends execute immediately.

When a send is held for approval, a person decides it in the portal; see [approval queues](https://molted.email/docs/approval-queues.md) for reading the queue and handing a person the decision link.
