API reference Markdown

Mailboxes

A mailbox is a sending account of the workspace. The API connects a mailbox with SMTP and IMAP, reads mailboxes and changes four settings of an existing mailbox. Connecting with Google or Microsoft sign-in needs a browser and stays in the app.

Method Path Action
GET /api/v1/mailboxes List mailboxes
POST /api/v1/mailboxes Connect a mailbox with SMTP and IMAP
GET /api/v1/mailboxes/{id} Get a mailbox
PATCH /api/v1/mailboxes/{id} Change the daily limit, sender name, signature or pause

Connect a mailbox#

POST /api/v1/mailboxes connects a mailbox with SMTP and IMAP details. The server tests both connections first, as the app does, and saves nothing when the test fails. The password is encrypted and never returned.

Field Type Notes
email string Required. The mailbox address.
password string Required. Use an app password. Gmail and Microsoft 365 need one, and the main password must not be used.
host string One host for SMTP and IMAP. Otherwise send smtp_host and imap_host.
smtp_port, imap_port integer Defaults 587 and 993.
username string Default is the address.
from_name string The sender name.
daily_limit integer Default is the default limit of the workspace.
curl -X POST "https://app.anymail.watch/api/v1/mailboxes" \
  -H "Authorization: Bearer $ANYMAIL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"email":"ada@acme.com","password":"app-password","host":"mail.acme.com","from_name":"Ada Lovelace"}'
const res = await fetch("https://app.anymail.watch/api/v1/mailboxes", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ANYMAIL_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"email": "ada@acme.com", "password": "app-password", "host": "mail.acme.com", "from_name": "Ada Lovelace"}),
});
console.log(res.status, await res.text());
import os
import requests

response = requests.request(
    "POST",
    "https://app.anymail.watch/api/v1/mailboxes",
    headers={
        "Authorization": f"Bearer {os.environ['ANYMAIL_TOKEN']}",
    },
    json={'email': 'ada@acme.com', 'password': 'app-password', 'host': 'mail.acme.com', 'from_name': 'Ada Lovelace'},
)
print(response.status_code, response.text)

Response 201 returns the mailbox in the shape above.

Status Message
400 Unknown field(s): …, Enter the mailbox address inemail., `password` is required …, Send `host`, or both `smtp_host` and `imap_host`., Host … is not allowed: … for a host on a private network, Couldn't connect, nothing was saved. … with the message of the mail server
409 This mailbox is already connected to the workspace.

The password travels in the request. When an AI assistant makes the call, it also passes through the conversation, so create an app password only for this and revoke it if the chat is shared. A new mailbox needs a gradual warm-up before cold email: start at 20 to 30 messages a day.

List mailboxes#

The list is not paginated. next_cursor is always null.

curl "https://app.anymail.watch/api/v1/mailboxes" \
  -H "Authorization: Bearer $ANYMAIL_TOKEN"
const res = await fetch("https://app.anymail.watch/api/v1/mailboxes", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.ANYMAIL_TOKEN}`,
  },
});
console.log(res.status, await res.text());
import os
import requests

response = requests.request(
    "GET",
    "https://app.anymail.watch/api/v1/mailboxes",
    headers={
        "Authorization": f"Bearer {os.environ['ANYMAIL_TOKEN']}",
    },
)
print(response.status_code, response.text)

Response 200

{
  "data": [
    {
      "id": "b2c3d4e5-0000-4000-8000-000000000001",
      "email": "sales@example.com",
      "provider": "smtp_imap",
      "status": "active",
      "active": true,
      "daily_limit": 50,
      "sent_today": 12,
      "timezone": "Europe/Warsaw",
      "from_name": "Ada Lovelace",
      "last_poll_error": null,
      "last_polled_at": "2026-09-04T08:55:00.000+00:00",
      "paused_from": null,
      "paused_to": null,
      "domain_health": {
        "domain": "example.com",
        "checked_at": "2026-09-04T03:00:00.000+00:00",
        "spf": "ok",
        "dkim": "unknown",
        "dmarc": "missing"
      },
      "created_at": "2026-08-01T00:00:00.000+00:00"
    }
  ],
  "next_cursor": null
}
Field Values and notes
provider smtp_imap, m365 or gmail.
status error, paused, frozen or active. The precedence matches Settings, Accounts: an IMAP read error, then disabled, then frozen for the period paused_from to paused_to, then active.
sent_today Messages sent today in the time zone of the mailbox.
domain_health spf, dkim and dmarc are each ok, missing, conflicting or unknown. The values come from the latest hourly check of the domain monitor. unknown means the check did not run or the resolver did not answer. It does not mean that the record is missing. checked_at: null means the domain was never checked.

The response never contains SMTP, IMAP or OAuth credentials, signatures or BCC addresses.

Errors: 401, 403, 429 and 500 only.

Get a mailbox#

GET /api/v1/mailboxes/{id} returns one mailbox in the shape above, without the data wrapper.

curl "https://app.anymail.watch/api/v1/mailboxes/b2c3d4e5-0000-4000-8000-000000000001" \
  -H "Authorization: Bearer $ANYMAIL_TOKEN"
const res = await fetch("https://app.anymail.watch/api/v1/mailboxes/b2c3d4e5-0000-4000-8000-000000000001", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.ANYMAIL_TOKEN}`,
  },
});
console.log(res.status, await res.text());
import os
import requests

response = requests.request(
    "GET",
    "https://app.anymail.watch/api/v1/mailboxes/b2c3d4e5-0000-4000-8000-000000000001",
    headers={
        "Authorization": f"Bearer {os.environ['ANYMAIL_TOKEN']}",
    },
)
print(response.status_code, response.text)

Errors: 404 with Mailbox not found., including a mailbox from another workspace and an id that is not a UUID.

Update a mailbox#

PATCH /api/v1/mailboxes/{id} changes only the fields you send, with the rules of the mailbox profile in the app. Send at least one. An unknown field returns 400.

Field Type Notes
daily_limit integer Messages per day, 1 or more.
from_name string or null The sender name. Control characters, line breaks included, become spaces. Empty or null clears it.
signature string or null The signature of this mailbox. Empty or null uses the signature template of the workspace. The API writes the signature but never returns it.
active boolean false pauses the mailbox without deleting it. Campaigns skip it until it is active again.
curl -X PATCH "https://app.anymail.watch/api/v1/mailboxes/b2c3d4e5-0000-4000-8000-000000000001" \
  -H "Authorization: Bearer $ANYMAIL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"daily_limit":40,"from_name":"Ada Lovelace"}'
const res = await fetch("https://app.anymail.watch/api/v1/mailboxes/b2c3d4e5-0000-4000-8000-000000000001", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.ANYMAIL_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"daily_limit": 40, "from_name": "Ada Lovelace"}),
});
console.log(res.status, await res.text());
import os
import requests

response = requests.request(
    "PATCH",
    "https://app.anymail.watch/api/v1/mailboxes/b2c3d4e5-0000-4000-8000-000000000001",
    headers={
        "Authorization": f"Bearer {os.environ['ANYMAIL_TOKEN']}",
    },
    json={'daily_limit': 40, 'from_name': 'Ada Lovelace'},
)
print(response.status_code, response.text)

Response 200 returns the mailbox after the change.

Errors

Status Message
400 Send at least one of: daily_limit, from_name, signature, active., Unknown field(s): …, Enter a whole number of at least 1 for the daily limit., `from_name` must be a string or null., `signature` must be a string or null., `active` must be a boolean.
404 Mailbox not found.

Raise the limit of a new mailbox slowly. A jump from 20 to 200 messages a day on a young domain is a common path to the spam folder.