API-first email for AI agents
Your agents need
their own inboxes
Create email inboxes with one API call. Your agents send, receive, reply, and forward — with threading, webhooks, real-time WebSocket events, semantic search, ephemeral TTL inboxes, long-poll wait-for-message, sub-addressing via plus-tags, and a native MCP server for Claude Code and Codex. Hosted in Singapore.
Inboxes
Email addresses for your AI agents
How it works
Create inboxes via API
One POST request creates a fully functional email inbox. DKIM, SPF, and DMARC configured automatically. No DNS wait, no manual setup.
inbox = client.inboxes.create(
username="support-agent",
domain="yourdomain.com"
)
# → support-agent@yourdomain.com is liveSend, reply, and forward
Your agents send, reply, and forward emails programmatically. One-call reply handles Re: prefixes and In-Reply-To threading automatically. Use plus-tag sub-addressing to route workflows through a single inbox — send from support+billing@ and filter by sub-address. Receive new mail via real-time webhooks — HMAC-signed, per-inbox scoped — or connect via WebSocket for instant push events without a public endpoint.
Search, extract, and process
Search messages by keyword, sender, direction, or time window — agents find OTPs or confirmations in milliseconds. Or use the wait-for-message endpoint to block until a reply arrives — no polling loop needed. Filter by date range (after/before), filter for messages with attachments, and download attachment files directly via API. Or integrate natively via MCP — no HTTP code needed.
Why AgentMail
Built from Singapore,
for Asia-Pacific
Most email APIs route through US data centres. That means 200ms+ latency, US-only data residency, and support during California business hours. We built the alternative.
API response time from Singapore
Your APAC agents respond in real-time. No round-trip to Virginia.
PDPA compliant by default
Data stays in APAC. Meet Singapore PDPA, Thailand PDPA, and MAS TRM requirements without extra work.
SGD invoicing
No FX fees. Local currency for APAC businesses.
APAC timezone engineering
Issues resolved during your business hours, not California's.
Use cases
What teams build with AgentMail
Customer service agents
Each agent gets its own inbox. Customers email support@, your AI handles it with full conversation threading.
Document intake
Receive invoices, contracts, and receipts via email. Agents extract structured data and route it.
Agent authentication
Give each agent a verified email for signing up to services, receiving OTPs, and identity verification.
Mutable Inboxes
Rename and relabel inboxes on the fly. Update displayName without recreating — partial updates, null to clear.
Usage Stats API
One call returns your full account picture: inbox count, message volumes, unread/quarantine counts, and top-5 busiest inboxes.
Inbox Purge
Reset a disposable inbox in one DELETE call — bulk-delete all messages without recreating the inbox. Optional ?before=ISO8601 for selective purging by date.
Global Cross-Inbox Search
Search across all your inboxes simultaneously. Find any message without knowing which inbox it arrived in — essential for multi-agent setups.
Reply & Forward API
One-call reply or forward — no manual header wrangling. POST .../reply and the API handles Re: prefix, In-Reply-To, and thread continuity automatically.
Ephemeral Inboxes (TTL)
Set ttlSeconds at creation and the inbox self-destructs automatically. Ideal for single-task agent workflows that should never leave residual state.
Native MCP Tools
Claude Code, Codex, and Gemini CLI can call send_email, list_threads, and search_messages as native tools. No HTTP boilerplate. 16 tools available out of the box.
Agent Identity
Inboxes can carry agentName and agentModel metadata for multi-agent fleet visibility. Know exactly which agent sent what — essential for audit trails in production deployments.
Sub-Addressing (Plus Tags)
Route workflows through a single inbox using plus-tags. Send from support+billing@acme.com via the fromTag parameter, then filter incoming messages by subAddress. Every message response includes its resolved sub-address — zero extra inboxes needed.
Direct Message Listing
Skip the thread abstraction. GET /inboxes/:id/messages returns paginated messages directly — newest first, with unread filtering. The fastest way to process an inbox without navigating thread IDs.
Wait-for-Message (Long-Poll)
Eliminate polling loops. GET /inboxes/:id/wait blocks until a new email arrives (or timeout). Your agent awaits OTPs, magic links, and replies with a single call — no while-loop, no wasted quota.
Webhook DLQ: Retry & Replay
When your endpoint goes down, failed webhooks land in a Dead Letter Queue with automatic exponential backoff retries — 5 attempts over 25 hours. Inspect payloads, manually replay individual events or replay-all in one call. 72-hour retention with auto-cleanup.
Idempotency Keys
Send an Idempotency-Key header on create/send requests. Retries after timeouts return the cached response instead of creating duplicates. Essential for autonomous agents with unreliable networks.
Per-Agent Usage Analytics
Track emails sent, received, and webhook events per inbox. GET /api/v1/analytics/inboxes returns per-agent breakdowns — know exactly which agents are driving volume before you hit a limit.
Configurable Send Caps
Set daily_send_cap, monthly_send_cap, and alert_threshold_pct per inbox via PATCH /inboxes/:id. Prevent runaway agents from burning through quotas — get alerted at 80%, hard-stopped at 100%.
Namespace-Based Billing & Quotas
Group inboxes into namespaces by agent, customer, or team. Set per-namespace send caps, inbox limits, and receive quotas — enforced at the API level (429 on breach). Pull charge-through billing line items per namespace for direct pass-through to your Stripe or billing system.
Real-Time Events
Connect via WebSocket to GET /api/v1/ws. Receive message.received and message.quarantined events the instant they occur. No polling. No public endpoint required. Ideal for agents running inside private networks or local dev environments.
API Reference
Everything is an API call
No SDK required. Every feature is a REST endpoint. Authenticate with a Bearer token, send JSON, get JSON back.
Create a new inbox for your agent
Request
{
"username": "support-agent",
"displayName": "Customer Support AI"
}Response
{
"ok": true,
"data": {
"id": "inb_abc123",
"address": "support-agent@yourdomain.com",
"dkimSelector": "am1710489600",
"status": "active"
}
}Send an email from your agent's inbox. Use fromTag to send from a plus-tagged sub-address (e.g. support+billing@).
Request
{
"to": ["customer@example.com"],
"subject": "Re: Your request",
"bodyText": "We've processed your order.",
"fromTag": "billing",
"replyToMessageId": "msg_xyz789"
}Response
{
"ok": true,
"data": {
"id": "msg_def456",
"threadId": "thr_abc123",
"subAddress": "billing",
"status": "sent"
}
}List conversation threads with messages
Response
{
"ok": true,
"data": {
"threads": [{
"id": "thr_abc123",
"subject": "Order #1234",
"messageCount": 4,
"unreadCount": 1,
"participants": ["agent@acme.com", "customer@example.com"]
}]
}
}Download an email attachment — stream the file directly. Use ?inline=true to render in browser. Agents can process invoices, contracts, and PDFs received via email.
Response
// Binary file stream
// Content-Type: application/pdf
// Content-Disposition: attachment; filename="invoice.pdf"
// Content-Length: 48291
// Use GET /attachments/:id/meta for JSON metadataSearch messages with date-range + attachment filters. Critical for OTP workflows: find emails by time window. New params: after, before (ISO 8601), hasAttachments (true/false).
Response
// GET ?q=OTP&after=2026-03-15T22:00:00Z&hasAttachments=false
{
"ok": true,
"data": {
"messages": [{ "id": "msg_...", "subject": "Your OTP", "receivedAt": "..." }],
"query": { "after": "2026-03-15T22:00:00Z", "hasAttachments": false }
}
}Direct paginated message listing — skip the thread abstraction. Returns all messages for an inbox, newest first. Supports ?limit, ?cursor, ?unread=true, and ?subAddress=billing filtering.
Response
// GET /api/v1/inboxes/:id/messages?limit=5&subAddress=billing
{
"ok": true,
"data": {
"messages": [{ "id": "msg_...", "subject": "Invoice #1234", "subAddress": "billing", "readAt": null }],
"nextCursor": "msg_xyz..."
}
}Long-poll wait for new message — blocks until an email arrives or timeout expires. Eliminates polling loops. Pass ?timeout=30 (5–60s) and ?after=<ISO8601> to only trigger on new messages.
Response
// GET /api/v1/inboxes/:id/wait?timeout=30&after=2026-03-23T23:00:00Z
// Blocks up to 30s, returns immediately on new message:
{ "ok": true, "data": { "id": "msg_...", "subject": "OTP: 847291" } }
// Or on timeout:
{ "ok": true, "data": null, "timeout": true }Account-wide usage analytics — total emails sent/received today and this month, per-inbox event breakdown, and webhook delivery counts. One call gives you the full picture.
Response
{
"ok": true,
"data": {
"period": "today",
"totals": { "sent": 142, "received": 89, "webhooks_fired": 231 },
"byInbox": [
{ "inboxId": "inb_abc", "address": "support@acme.com", "sent": 98, "received": 44 }
]
}
}Per-inbox analytics — daily and monthly send/receive counts, current cap utilisation, and alert threshold status. Use to build usage dashboards or drive auto-scaling logic.
Response
{
"ok": true,
"data": {
"inboxId": "inb_abc123",
"daily": { "sent": 42, "received": 18, "cap": 500, "pct_used": 8.4 },
"monthly": { "sent": 1204, "received": 531, "cap": 10000, "pct_used": 12.0 },
"alert_threshold_pct": 80,
"alert_triggered": false
}
}Register a webhook for real-time events
Request
{
"url": "https://yourapp.com/webhook",
"events": ["message.received", "message.sent"],
"inboxId": "inb_abc123"
}Response
{
"ok": true,
"data": {
"id": "wh_abc123",
"secret": "whsec_...",
"status": "active"
}
}List dead letter queue events for a webhook — failed and pending deliveries. Paginated. Query: status (failed|pending), limit, cursor.
Response
{
"ok": true,
"data": {
"events": [{
"id": "wde_abc123",
"webhookId": "wh_xyz",
"eventType": "message.received",
"payload": { ... },
"status": "failed",
"attempts": 3,
"lastError": "Connection refused",
"nextRetryAt": "2026-04-13T12:00:00Z",
"createdAt": "2026-04-12T10:00:00Z"
}],
"nextCursor": "wde_xyz..."
}
}Manually replay a single failed event. Re-fires the original payload immediately, bypassing backoff schedule.
Response
{
"ok": true,
"data": {
"eventId": "wde_abc123",
"status": "replayed",
"deliveryId": "wdl_xyz"
}
}Replay all failed events for a webhook in one call. Each fires immediately with backoff schedule reset.
Response
{
"ok": true,
"data": {
"queued": 4,
"message": "4 events queued for replay"
}
}WebSocket real-time event stream — connect once and receive message.received and message.quarantined events the moment they occur. No polling. No public webhook endpoint required. Authenticate via Authorization header or ?token= query param. Perfect for agents in private networks or local environments.
Response
// Connect: wss://agentmail.cyberforge.one/api/v1/ws
// Auth header: Authorization: Bearer am_live_YOUR_KEY
// Or query param: ?token=am_live_YOUR_KEY
// Incoming events (JSON, one per message):
{ "event": "message.received", "data": { "id": "msg_...", "inboxId": "inb_...", "subject": "Your OTP", "from": "noreply@service.com", "receivedAt": "2026-03-31T00:12:34Z" } }
{ "event": "message.quarantined", "data": { "id": "msg_...", "inboxId": "inb_...", "reason": "spam_score_exceeded", "receivedAt": "2026-03-31T00:12:35Z" } }Also available: GET /inboxes · DELETE /inboxes/:id · PATCH /inboxes/:id · GET /api/v1/account/stats · GET /api/v1/analytics · GET /api/v1/analytics/inboxes · PATCH /messages/:id/read · DELETE /inboxes/:id/messages · GET /messages/search · POST /inboxes/:id/messages/:msgId/reply · POST /inboxes/:id/messages/:msgId/forward · GET /api/v1/ws (WebSocket event stream) · GET /inboxes/:id/quarantine · POST /auth/keys · GET /attachments/:id · GET /attachments/:id/meta · POST /mcp (MCP server — JSON-RPC 2.0) · GET /api/v1/namespaces · POST /api/v1/namespaces · PATCH /api/v1/namespaces/:slug · DELETE /api/v1/namespaces/:slug · GET /api/v1/namespaces/:slug/billing
OpenClaw Integration
Give your AI assistant
a real email address
AgentMail integrates natively with OpenClaw — the open-source AI assistant platform. Install the skill, and your agents can send, receive, and manage email without writing any code.
# 1. Download the AgentMail skill
curl -sL https://agentmail.cyberforge.one/skill \
-o ~/.agents/skills/agentmail/SKILL.md \
--create-dirs
# 2. Add your API key
openclaw config set agentmail.apiKey am_live_YOUR_KEY
# 3. Restart to load the skill
openclaw gateway restart
# Done. Your agents can now use email:
# "Create an inbox for my support agent"
# "Send an email to customer@example.com"
# "Check new emails in the intake inbox"
# "Reply to the latest support thread"One skill file teaches your agent the full API. Add your key, restart, done.
Automated customer support
Your OpenClaw agent monitors an inbox, reads new emails, drafts responses using your LLM, and replies — all without human intervention. Escalates complex issues to your team.
Document processing pipeline
Emails with invoices, contracts, or receipts arrive at an inbox. OpenClaw extracts data, routes to the right workflow, and sends a confirmation reply.
Multi-agent coordination
Each agent in your OpenClaw setup gets its own email identity. They email external services, receive OTPs, and authenticate — just like a human teammate would.
Scheduled reports & alerts
Use OpenClaw cron jobs to check inboxes on a schedule. Process incoming data, compile summaries, and email reports to stakeholders automatically.
MCP Integration
Native MCP server for AI coding agents
Claude Code, Codex, Gemini CLI, and any MCP client can use AgentMail as a tool without writing HTTP code. One config entry, zero boilerplate. AgentMail is the only email API with Tools + Resources + Prompts — the most MCP-native email API for AI agents.
{
"mcpServers": {
"agentmail": {
"url": "https://agentmail.cyberforge.one/mcp",
"headers": {
"Authorization": "Bearer am_live_YOUR_KEY"
}
}
}
}Add this to your .mcp.json and your coding agent gets 16 email tools immediately — no HTTP client, no boilerplate.
list_inboxescreate_inboxget_inboxupdate_inboxdelete_inboxsend_emailget_messagelist_messagesreply_to_messageforward_messagesearch_messagessearch_inboxget_threadlist_threadsget_account_statspurge_inboxdownload_attachmentlist_webhooksOnly AgentMail has Tools + Resources + Prompts
The MCP server at POST /mcp speaks JSON-RPC 2.0. Authentication is the same Bearer token you use for the REST API. 16 tools, 3 Resources (inbox messages, threads, account metrics), and 3 pre-built workflow Prompts (process-inbound-support, follow-up-quote, summarize-thread) — making AgentMail the most MCP-native email API for AI agents.
Pricing
Start free, pay when you scale
No credit card required. No hidden fees. Upgrade when your agents outgrow the free tier.
Free
For prototyping
- 3 inboxes
- 3,000 emails/month
- Webhook management API
- Webhook delivery logs
- Idempotency keys
- Message search + date filters
- Attachment download API
- Community support
Pro
For production
- 50 inboxes
- 50,000 emails/month
- Custom domains + DKIM
- Message search + semantic search + date filters
- Attachment download API
- Webhook management + delivery logs
- Idempotency keys
- Priority support
Enterprise
Custom volume
- Unlimited inboxes
- Dedicated IPs
- APAC data residency SLA
- SSO / SAML
- Dedicated support
FAQ
Common questions
Ready to give your agents email?
One API call. One inbox. Start in under two minutes.
Get your API key