REST API for programmatic mailbox access. Send and read emails from your AI agents with simple HTTP calls.
All API requests require a Bearer token in the Authorization header. Create API keys from your dashboard.
Authorization: Bearer ai_your_api_key_hereAPI keys can be scoped to a specific mailbox or left unscoped (access all mailboxes). Scoped keys don't need to pass the mailbox query parameter.
https://agentmbox.com/api/v1/api/v1/mailList emails in a mailbox. Returns summaries sorted by most recent.
mailboxstringagent@agentmbox.com. Not required if API key is scoped to a mailbox.limitnumberoffsetnumbercurl "https://agentmbox.com/api/v1/mail?mailbox=agent@agentmbox.com&limit=10" \
-H "Authorization: Bearer ai_your_api_key"{
"mailbox": "agent@agentmbox.com",
"emails": [
{
"id": "M1234",
"from": [{ "name": "Alice", "email": "alice@example.com" }],
"to": [{ "email": "agent@agentmbox.com" }],
"subject": "Hello from Alice",
"receivedAt": "2026-03-10T12:00:00Z",
"preview": "Hey, just wanted to check in about...",
"isRead": false
}
],
"limit": 10,
"offset": 0
}/api/v1/mail/:idFetch the full content of a single email, including body and attachments metadata.
idstring*mailboxstringcurl "https://agentmbox.com/api/v1/mail/M1234?mailbox=agent@agentmbox.com" \
-H "Authorization: Bearer ai_your_api_key"{
"email": {
"id": "M1234",
"from": [{ "name": "Alice", "email": "alice@example.com" }],
"to": [{ "email": "agent@agentmbox.com" }],
"cc": null,
"subject": "Hello from Alice",
"receivedAt": "2026-03-10T12:00:00Z",
"textBody": "Hey, just wanted to check in about the project.",
"htmlBody": "<p>Hey, just wanted to check in about the project.</p>",
"hasAttachment": false,
"isRead": true
}
}/api/v1/mail/sendSend an email from one of your agent mailboxes.
fromstring*tostring | string[]*subjectstring*textstringhtmlstringtext and html are provided, HTML takes precedence.curl -X POST "https://agentmbox.com/api/v1/mail/send" \
-H "Authorization: Bearer ai_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"from": "agent@agentmbox.com",
"to": "client@example.com",
"subject": "Your report is ready",
"text": "Hi, your weekly report has been generated."
}'{
"success": true
}{
"from": "agent@agentmbox.com",
"to": ["alice@example.com", "bob@example.com"],
"subject": "Team update",
"html": "<h1>Weekly Update</h1><p>Here are the highlights...</p>"
}/api/v1/mail/:idPermanently delete an email from the mailbox.
idstring*mailboxstringcurl -X DELETE "https://agentmbox.com/api/v1/mail/M1234?mailbox=agent@agentmbox.com" \
-H "Authorization: Bearer ai_your_api_key"{
"success": true
}These endpoints use session cookie authentication (same as the dashboard) for managing domains, mailboxes, and API keys programmatically.
/api/v1/domainsList all custom domains for the current user. Each domain includes DNS records to configure.
{
"domains": [
{
"id": "uuid",
"domain": "example.com",
"verified": false,
"mxVerified": false,
"spfVerified": false,
"dkimVerified": false,
"dnsRecords": {
"verification": { "type": "TXT", "name": "_agentmbox.example.com", "value": "agentmbox-verify-..." },
"mx": { "type": "MX", "name": "example.com", "value": "mail.agentmbox.com", "priority": 10 },
"spf": { "type": "TXT", "name": "example.com", "value": "v=spf1 include:mail.agentmbox.com ~all" }
}
}
]
}/api/v1/domainsAdd a custom domain. Returns DNS records to configure at your registrar.
domainstring*/api/v1/domains/:id/verifyCheck DNS records and update domain verification status. Performs live TXT, MX, and SPF lookups.
idstring*{
"verified": true,
"txtVerified": true,
"mxVerified": true,
"spfVerified": true,
"dkimVerified": false
}/api/v1/domains/:idDelete a custom domain. Fails if the domain still has mailboxes.
idstring*/api/v1/mailboxesList all mailboxes for the current user.
{
"mailboxes": [
{
"id": "uuid",
"address": "agent@agentmbox.com",
"localPart": "agent",
"domainName": "agentmbox.com",
"displayName": "My Agent",
"createdAt": "2026-03-10T12:00:00Z"
}
]
}/api/v1/mailboxesCreate a new mailbox. Uses @agentmbox.com by default, or a verified custom domain.
localPartstring*domainIdstringdisplayNamestring/api/v1/mailboxes/:idPermanently delete a mailbox, all its emails, and associated API keys.
idstring*All errors return a JSON object with an error field.
{
"error": "You are not authorized to send from this address"
}| Status | Meaning |
|---|---|
| 400 | Missing or invalid parameters |
| 401 | Missing or invalid API key |
| 403 | Not authorized for this resource (e.g. sending from a mailbox you don't own) |
| 404 | Mailbox or email not found |
| 502 | Mail server error (temporary, retry with backoff) |
Every mailbox also supports standard IMAP for use with any email client.
| Server | mail.agentmbox.com |
| Port | 993 |
| Security | TLS (implicit) |
| Username | your-agent@agentmbox.com |
| Password | Your mailbox password (shown once at creation) |
Send emails via SMTP from any client or framework.
| Server | mail.agentmbox.com |
| Port | 465 |
| Security | TLS (implicit) |
| Username | your-agent@agentmbox.com |
| Password | Your mailbox password |