Skip to content

ResourcesMail handling

Mail handling API

Decide what happens to mail once it reaches a mailbox. You can forward copies to other addresses, reply automatically while you're away, and send new conversations to another mailbox. These endpoints match the Mail handling settings of a mailbox in the dashboard. They take a mailbox ID from the Mailboxes API.

Last updated

Manage mailbox forwarding

GET/v1/mailboxes/:id/forwarding
POST/v1/mailboxes/:id/forwarding
DELETE/v1/mailboxes/:id/forwarding/:forwarding_id

Scope: mailbox_forwarding:read for GET and mailbox_forwarding:write to create and delete. A mailbox can have up to three destinations, pending or active.

Creating a destination emails that address a confirmation link, valid for 24 hours, and returns a pending object. Nothing is forwarded until the recipient confirms. The mailbox keeps its own copy, and spam is never forwarded.

Set sender to one exact From address to forward only mail from that sender. Leave it out to forward every message that isn't spam. Set recipient to the mailbox's primary address or an alias to forward only mail sent to it. Leave it out to match every address. With both set, a message must match both. Forwarding a mailbox to itself, or a loop across mailboxes, is rejected.

Create request

{
  "destination": "owner@example.net",
  "sender": "newsletter@example.com",
  "recipient": "nabeel@example.com"
}

List response

{
  "object": "mailbox_forwarding_list",
  "mailbox_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "data": [
    {
      "object": "mailbox_forwarding",
      "id": "fwd_0123456789abcdefghjkmnpq",
      "mailbox_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
      "destination": "owner@example.net",
      "sender": "newsletter@example.com",
      "recipient": "nabeel@example.com",
      "status": "pending",
      "verification_sent_at": "2026-07-13T12:00:00.000Z",
      "verified_at": null,
      "created_at": "2026-07-13T12:00:00.000Z",
      "updated_at": "2026-07-13T12:00:00.000Z"
    }
  ]
}

Examples

curl -X POST https://shipmail.to/api/v1/mailboxes/f47ac10b-58cc-4372-a567-0e02b2c3d479/forwarding \
  -H "Authorization: Bearer sm_live_..." \
  -H "Content-Type: application/json" \
  -d '{"destination":"owner@example.net","sender":"newsletter@example.com","recipient":"nabeel@example.com"}'

curl https://shipmail.to/api/v1/mailboxes/f47ac10b-58cc-4372-a567-0e02b2c3d479/forwarding \
  -H "Authorization: Bearer sm_live_..."

curl -X DELETE https://shipmail.to/api/v1/mailboxes/f47ac10b-58cc-4372-a567-0e02b2c3d479/forwarding/fwd_0123456789abcdefghjkmnpq \
  -H "Authorization: Bearer sm_live_..."

Update auto-reply

PATCH/v1/mailboxes/:id/auto-reply

Scope: mailboxes:write. Rate limit tier: write. Sets an out-of-office reply for a mailbox. Each sender gets it at most once every 7 days, however many times they write. While the out-of-office dates are running, delivery routing stops picking this mailbox for new conversations. Conversations it already has stay here.

Request body

FieldTypeRequiredDescription
enabledbooleanYesTurns the auto-reply on or off.
bodystring | nullWhen enabledText of the reply. Max 5,000 characters. Required when enabled is true.
from_datestring | nullNoStart date in UTC ISO 8601.
to_datestring | nullNoEnd date in UTC ISO 8601. Must be after from_date.

Example

curl -X PATCH https://shipmail.to/api/v1/mailboxes/f47ac10b-58cc-4372-a567-0e02b2c3d479/auto-reply \
  -H "Authorization: Bearer sm_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "enabled": true,
    "body": "I am away until January 6. I will reply when I return.",
    "from_date": "2026-12-23T00:00:00Z",
    "to_date": "2027-01-06T00:00:00Z"
  }'

Returns the updated mailbox object.

Configure delivery routing

GET/v1/mailboxes/:id/delivery-routing
PATCH/v1/mailboxes/:id/delivery-routing

Read with mailboxes:read and update with mailboxes:write. Routing runs once per conversation, when it first arrives at the mailbox's primary or plus-primary address. Mail sent to an alias, plus-alias, or catch-all identity skips routing and stays with that address. Later messages in a routed conversation go to the same mailbox as the first one.

Use keep to deliver here, fixed for one destination, or round_robin to take turns between two or more destinations, in order. Fixed and round-robin both need a fallback mailbox. The mailbox you route from can be a destination and the fallback too. A destination that is out of office gets no new conversations. If no destination can take the message, the fallback gets it.

Round-robin example

curl -X PATCH https://shipmail.to/api/v1/mailboxes/f47ac10b-58cc-4372-a567-0e02b2c3d479/delivery-routing \
  -H "Authorization: Bearer sm_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "round_robin",
    "destination_mailbox_ids": [
      "11111111-1111-4111-8111-111111111111",
      "22222222-2222-4222-8222-222222222222"
    ],
    "fallback_mailbox_id": "33333333-3333-4333-8333-333333333333"
  }'

The response lists every destination that can receive mail, and the saved mode. A new automatic route shows pending, then active once the mail-routing cache has synced. If a routed conversation gets no reply, assignment, or note within 24 hours, it stays where it is and Shipmail alerts the people who can access that mailbox.