Agents
An email API, a CLI and SDKs for every mailbox
Your cloudmail mailboxes are available over a REST API described by OpenAPI 3.1, a command-line client, and TypeScript and Python SDKs. Signed webhooks and live event streams tell your code when mail arrives.
cloudmail config set base-url https://mail.yourdomain.com
cloudmail auth login # paste a ttk_ token; input is hidden
cloudmail mail list --folder inbox --unread --limit 10
cloudmail mail send --to priya@example.org \
--subject 'Pilot start' --text 'Monday works.' --dry-run
cloudmail approval list # sends held for a person
cloudmail events tail --mailbox support@yourdomain.comimport { Cloudmail, isPendingApproval } from "@cloudmail/sdk";
const mail = new Cloudmail({
baseUrl: "https://mail.yourdomain.com",
token: process.env.CLOUDMAIL_TOKEN!,
});
const result = await mail.mail.send("support@yourdomain.com", {
to: "priya@example.org",
subject: "Pilot start date",
text: "Monday works.",
});
if (isPendingApproval(result)) {
// Nothing was sent. A person approves it in the app.
console.log("held:", result.approval_url);
}from cloudmail import Cloudmail, is_pending_approval
cm = Cloudmail("https://mail.yourdomain.com", token="ttk_...")
result = cm.mail.send(
"support@yourdomain.com",
to="priya@example.org",
subject="Pilot start date",
text="Monday works.",
)
if is_pending_approval(result):
print("Waiting for approval:", result.approval_url) # don't retryWhat you build with
REST with OpenAPI 3.1
Your deployment serves the document, with a readable reference at /api/docs.
Scoped tokens
Limit a token to scopes such as mail:read or mail:send, and to specific mailboxes.
Idempotency keys
Every send and create accepts one, so a retry never sends twice.
The cloudmail CLI
Prebuilt for macOS, Linux and Windows, with JSON output and --dry-run on every change.
TypeScript and Python SDKs
Typed clients with webhook verification and a reconnecting event stream.
Webhooks and live events
Signed events for received, sent, bounced, opened and clicked mail, also over WebSocket and SSE.
Questions about the API, CLI and SDKs
Is this a transactional email API like Resend or Amazon SES?
It can send from your code, but it is a full mailbox: replies arrive in the same inbox, threads stay together, and a person can take over in the app. For delivery it uses Cloudflare Email Service, or your own Amazon SES or Resend account.
How are webhooks retried?
Answer with a 2xx within 10 seconds. Anything else is retried five more times over about nine hours, and a failed delivery can be re-sent from the app, the CLI or the API.
Are the SDKs on npm and PyPI?
Not yet. Install them from the sdk folder of the repository.
What are the rate limits?
600 API requests a minute per caller, and 120 a minute for MCP. Each mailbox also has hourly and daily send caps that an administrator can raise.
Related features
In the docs: Programmatic access. See every cloudmail feature, or browse the documentation.
One-time licence