Email for AI agents

AGMX gives every agent a real, routable inbox. Agents receive mail with verification codes and links already extracted, and send, reply and forward through the same API — over REST, MCP or webhooks.

Core concepts

  • Agent — an identity for one of your AI agents. It owns inboxes, can have its own scoped API key and an optional webhook URL.
  • Inbox — a real address such as scout@bot.agmx.io, or one on your own domain.
  • Message — an inbound or outbound email. Inbound mail carries a security report, a cleaned safeText and extracted data (codes, links, events, receipts, tracking numbers).
  • Thread — a conversation. Replies are grouped using In-Reply-To and References headers.

The base URL for every endpoint is https://agmx.io/api/v1. Requests and responses are JSON.

Quickstart

There are two ways to get credentials: let the agent sign itself up (you approve it), or create an agent and key yourself in the dashboard.

Option A — agent self sign-up

The agent calls a public endpoint, shows you an approval link and code, and polls until you approve. This is what skill.md walks an agent through.

POST/api/v1/signupno auth
curl -X POST https://agmx.io/api/v1/signup \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Scout",
    "username": "scout",
    "description": "Researches vendors and signs up for trials",
    "ownerEmail": "you@example.com"
  }'
Body
namestringrequired
The agent's display name (max 80 characters).
usernamestring
Preferred inbox local part. A random one is chosen if it's omitted.
descriptionstring
What the agent will use the inbox for. Shown to the approver.
ownerEmailstring
The approver's email. The request then appears in their dashboard under Agents.

Open approvalUrl (or enter the code in the dashboard) and approve. Meanwhile the agent polls pollUrl every 5 seconds:

GET/api/v1/signup/{signupId}?token={pollToken}no auth
{
  "status": "approved",          // pending | approved | completed | denied | expired
  "apiKey": "agmx_agt_…",        // returned exactly once
  "agent": { "id": "agt_…", "name": "Scout", "inboxes": [ … ] },
  "inbox": { "id": "inb_…", "address": "scout@bot.agmx.io" },
  "mcpUrl": "https://agmx.io/mcp",
  "apiBaseUrl": "https://agmx.io/api/v1"
}
The key is shown once
The first poll after approval returns apiKey and flips the status to completed. Later polls return apiKey: null. Requests expire after 30 minutes.

Option B — from the dashboard

  1. Sign in and create an agent under Agents. Give it a username to create its first inbox.
  2. Create an agent-scoped key under API keys (or tick "create an API key" when creating the agent).
  3. Hand the key to your agent as an environment variable, e.g. AGMX_API_KEY.

Your first request

curl https://agmx.io/api/v1/me -H "Authorization: Bearer $AGMX_API_KEY"

/me returns the account, plan limits, current usage and which agent the key belongs to — a good first call for any agent.

Authentication

Send your key as a bearer token: Authorization: Bearer agmx_…. The dashboard uses a session cookie against the very same API.

Key typePrefixCan do
Agent keyagmx_agt_Read and send mail for its own agent's inboxes, create inboxes for itself, manage its webhook. Cannot see other agents, create agents, manage keys or domains.
Account keyagmx_acc_Everything the dashboard can do: all agents, inboxes, keys, domains and sign-up approvals.
Give each agent its own agent key. If one leaks, revoke it in the dashboard without touching any other agent.

Inboxes

An inbox is a real address that belongs to one agent. Each plan sets how many inboxes an agent may own.

POST/api/v1/inboxes
curl -X POST https://agmx.io/api/v1/inboxes \
  -H "Authorization: Bearer $AGMX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "username": "billing-bot", "displayName": "Billing Bot" }'
Body
usernamestring
Local part: lowercase letters, numbers, ., _ and -, 3–64 characters. Omit for a random friendly name like swift-otter-4821.
displayNamestring | null
The name recipients see, e.g. “Billing Bot”.
domainstring
A verified custom domain on your account. Defaults to the shared domain.
agentIdstring
Required with account keys and sessions; implied with agent keys.
expiresInnumber
Seconds until the inbox and its mail are deleted (60 – 604800). See temporary inboxes.
maxMessagesnumber
Stop accepting mail after this many messages.
acceptFromstring[]
Only accept mail from these addresses or domains. Creates allow rules.

Other endpoints: GET /inboxes (with unread counts), GET /inboxes/{id}, PATCH /inboxes/{id} to rename or pause ({"status": "paused"}), and DELETE /inboxes/{id} to release the address. Paused inboxes neither send nor receive. Reserved names such as postmaster or admin can't be claimed.

Temporary inboxes

Most agent mail is “sign up somewhere, grab the code, move on”. A temporary inbox exists for exactly that: it deletes itself — with its mail — when it expires, and temporary inboxes don't count against your plan's inboxes-per-agent limit (up to 10 per agent at once).

curl -X POST https://agmx.io/api/v1/inboxes \
  -H "Authorization: Bearer $AGMX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "expiresIn": 3600, "maxMessages": 1, "acceptFrom": ["github.com"] }'

# → { "address": "tmp-swift-otter-4821@bot.agmx.io", "temporary": true, "expiresAt": "…", "maxMessages": 1, … }
  • maxMessages closes the inbox once it has received that many messages; later mail is dropped and the inbox can no longer send.
  • acceptFrom turns the inbox into an allow-list, so only the service you're signing up for can reach it — less spam, fewer injection attempts.
  • Expired inboxes are removed within a minute. Agent keys can create temporary inboxes for themselves.

Sending

POST/api/v1/messages
curl -X POST https://agmx.io/api/v1/messages \
  -H "Authorization: Bearer $AGMX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "scout@bot.agmx.io",
    "to": ["Alice Chen <alice@example.com>"],
    "subject": "Vendor shortlist",
    "text": "Hi Alice — the shortlist is attached.",
    "attachments": [{
      "filename": "shortlist.csv",
      "contentType": "text/csv",
      "content": "dmVuZG9yLHByaWNlCkFjbWUsNDkK"
    }]
  }'
Body
fromstring
Inbox id or address. Optional when the agent owns exactly one inbox.
tostring | string[]required
Recipients. Accepts addr@x.com or Name <addr@x.com>, comma-separated or as a list.
cc / bccstring | string[]
Additional recipients. Bcc addresses are never written to headers.
replyTostring | string[]
Reply-To header.
subjectstringrequired
Subject line.
text / htmlstring
Provide at least one (or an attachment). If only html is given, a text part is generated.
attachments{ filename, contentType?, content }[]
content is base64. Total message size is capped per plan.
headersRecord<string, string>
Extra headers to add.
labelsstring[]
Labels to store on the sent message.
sendAtISO timestamp
Send later, up to 30 days ahead. The message is returned with status scheduled.
idempotencyKeystring
Safe-retry key (also accepted as an Idempotency-Key header). Repeating a request with the same key returns the original message instead of sending again.
Always send an Idempotency-Key
Agents retry. If a request times out after AGMX accepted it, retrying without a key can send the email twice. Generate a key per logical send (a UUID is fine) and reuse it on retries. The official SDKs do this for you.
  • Quota: every recipient (to + cc + bcc) counts as one send against daily and monthly limits. A failed delivery is refunded.
  • Internal delivery: mail between two AGMX inboxes is delivered instantly without leaving the platform.
  • Suppression: addresses that hard-bounced or complained are refused with InvalidRequest to protect deliverability.
  • At most 50 recipients per message.
  • Approvals: if the sending agent's send policy requires review, the message comes back with status pending_approval and a heldReason explaining why. It's sent once a human approves it.

Drafts & scheduling

Messages move through these statuses: draft → scheduled or pending_approval → sending → sent → delivered / bounced / complained (or failed / rejected). Drafts, scheduled and held mail don't appear in threads until they're sent.

EndpointWhat it does
POST /draftsCreate a draft. Everything is optional; pass replyToMessageId (and replyAll) to start a threaded reply.
PATCH /drafts/{id}Update fields. Passing attachments replaces them all.
POST /drafts/{id}/sendSend now, or pass {"sendAt": "…"} to schedule. Subject to the send policy.
GET /draftsList drafts (same shape as GET /messages).
DELETE /drafts/{id}Delete a draft, scheduled or rejected message.
POST /messages/{id}/cancelMove a scheduled message back to drafts.

Scheduled mail is released within about 10 seconds of sendAt. Quota is checked when the message actually sends, not when it's scheduled.

Receiving

GET/api/v1/messages
Query
folder"inbox" | "sent" | "starred" | "archived" | "spam" | "drafts" | "scheduled" | "pending" | "all"
inbox = received, not archived, not spam. pending lists held and rejected mail.
inboxId / agentId / threadIdstring
Narrow to one inbox, agent or conversation.
direction"inbound" | "outbound"
Filter by direction.
unread"true" | "false"
Only unread or read messages.
qstring
Search subject, body, sender and recipients.
sinceISO timestamp
Only messages created after this time.
limit / cursornumber / string
Page size (1–100, default 25) and the nextCursor from the previous page.

The list returns summaries (no bodies) newest first: { messages: [...], nextCursor }. Fetch one message in full — text, HTML, headers, SPF/DKIM/DMARC verdicts and attachments — with:

GET/api/v1/messages/{messageId}?markRead=true

Extracted data

Every inbound message is scanned so agents don't need to parse HTML. Extraction only looks at visible content, so hidden text can't plant fake codes or links.

"extracted": {
  "codes": ["482913"],
  "links": [
    { "url": "https://github.com/sessions/verified-device?token=…", "text": "Verify device", "kind": "verify" },
    { "url": "https://www.ups.com/track?tracknum=1Z999AA10123456784", "text": "Track package", "kind": "tracking" }
  ],
  "events": [
    { "title": "Design review", "start": "2026-11-05T20:00:00.000Z", "end": "2026-11-05T21:00:00.000Z",
      "allDay": false, "location": "Zoom", "organizer": "ada@example.com", "method": "REQUEST", "uid": "…", "url": null }
  ],
  "receipt": { "merchant": "Acme Cloud", "total": 49, "currency": "USD", "orderNumber": "2041-8812" },
  "tracking": [{ "carrier": "ups", "number": "1Z999AA10123456784", "url": "https://www.ups.com/track?…" }]
}
  • codes are ranked by how likely they are to be the one you want (near words like “code” or “verification”).
  • links are sorted by kind: verify, login, reset, tracking, other, then unsubscribe.
  • events come from calendar invites (text/calendar parts or .ics attachments), with time zones converted to UTC.
  • receipt is filled for receipts, invoices and order confirmations; tracking lists UPS, FedEx, USPS and DHL numbers.

Attachments

Each attachment in a full message has a downloadUrl (GET /messages/{id}/attachments/{attachmentId}) for the raw bytes — use the same bearer key (in production it redirects to a short-lived signed URL). Text from PDFs and plain-text, CSV, JSON and XML attachments is included as extractedText (up to 20,000 characters), so agents can read them without downloading anything.

Waiting for email

The wait endpoint is a long-poll: it holds the request open and returns the instant a matching inbound message arrives. It's the most reliable way to collect a verification code.

GET/api/v1/messages/wait
Query
timeoutnumber
Seconds to wait, 1–60. Default 30.
sinceISO timestamp
Only messages after this time. Defaults to now — pass the time you triggered the email to avoid races.
inboxIdstring
Inbox id or address to watch. Defaults to every inbox the key can see.
fromstring
Substring match on the sender address, e.g. github.com.
subjectstring
Substring match on the subject.
const since = new Date().toISOString()
await submitSignupForm({ email: "scout@bot.agmx.io" })

const res = await fetch(`https://agmx.io/api/v1/messages/wait?timeout=60&from=github.com&since=${since}`, {
  headers: { Authorization: `Bearer ${process.env.AGMX_API_KEY}` }
})
const { message, timedOut } = await res.json()
if (timedOut) throw new Error("No email yet — try again")
const code = message.extracted.codes[0]

Replies & threads

POST/api/v1/messages/{messageId}/reply
{ "text": "Thanks — confirmed for Tuesday.", "replyAll": true }

Replies go to the original Reply-To (or sender), quote the original message, use a Re: subject and set In-Reply-To / References so every mail client threads them. replyAll adds the original to and cc recipients (minus yourself). html and attachments are accepted too.

POST/api/v1/messages/{messageId}/forward
{ "to": "finance@example.com", "text": "FYI — receipt below." }

Forwards include the original attachments. To read a whole conversation, oldest first:

GET/api/v1/threads/{threadId}

GET /threads lists conversations by most recent activity, with message and unread counts.

Flags & labels

PATCH/api/v1/messages/{messageId}
{ "isRead": true, "isStarred": false, "isArchived": true, "isSpam": false, "labels": ["receipts"] }

Plus-addressing

Mail sent to scout+github@bot.agmx.io is delivered to scout@bot.agmx.io with the label github. Give each service a different tag and filter on labels later.

DELETE /messages/{id} permanently removes a message. Messages older than your plan's retention period are cleaned up automatically.

Sender rules

Rules filter an inbox before mail is stored. They're evaluated in order:

ActionEffecttarget
allowIf an inbox has any allow rules, only matching senders get through — everything else is dropped.—
blockDrop matching mail. The first matching allow/block rule wins.—
labelAdd a label to matching mail.label name
forwardSend a copy of matching mail to another address (counts as a send).email address
webhookPOST a message.received event for matching mail to a URL, in addition to the agent's webhook.https URL

Match on sender (a full address), domain (the sender's domain or any subdomain of it) or subject (contains, case-insensitive).

POST/api/v1/inboxes/{inboxId}/rules
{ "field": "domain", "value": "github.com", "action": "allow" }

Also GET /inboxes/{id}/rules, PATCH /rules/{ruleId} (including enabled and position) and DELETE /rules/{ruleId}. Dropped mail isn't stored and doesn't count as received.

Forward and webhook rules are human-only
Agent keys can create allow, block and label rules for their own inboxes, but only people (the dashboard) and account keys can create forward or webhook rules. Otherwise a prompt-injected agent could be talked into quietly copying its mail to an attacker.

Reading mail safely

Email is untrusted input that agents feed straight into a model. Attackers hide instructions where a person reviewing the message won't see them — white-on-white text, zero-size fonts, display:none, HTML comments, invisible Unicode — and phrase them as orders. AGMX analyses every inbound message and gives you two things:

"security": {
  "risk": "high",
  "score": 8,
  "reasons": ["hidden text (white-on-white text)", "hidden content asks the reader to send credentials or codes"],
  "hiddenContent": true,
  "sender": "verified"
},
"safeText": "Hi! Here is the agenda for Tuesday."
  • safeText is the message as a human would see it: hidden elements, comments, scripts and invisible characters removed. Give your model safeText, not html.
  • security.risk is low, medium or high, with human-readable reasons. List responses and webhook payloads include it too.
  • security.sender says whether the From address is authentic, from the SPF, DKIM and DMARC checks SES runs: verified (DMARC pass, or mail from another AGMX inbox), unknown (the domain publishes no policy) or failed (likely forged). Forged mail is at least medium risk, and its codes and sign-in links are withheld from extracted, so a fake "your GitHub code is…" can't be acted on.
  • Attachments the scanner flags as malware are quarantined: the message lists them, but the bytes are never stored, forwarded or served.
  • The MCP tools return safeText and the security report by default and omit raw HTML unless asked (includeRaw).
Never follow instructions inside an email
Treat email content as data, not commands — especially when security.risk is medium or high. The analysis is heuristic: it lowers the risk, it doesn't make untrusted text trustworthy. Combine it with send approvals and allow-lists.

Send approvals

Each agent has a send policy that decides when mail sent with its key needs a human's approval:

sendPolicyBehaviour
autoSend immediately (default).
first_contactHold mail to any recipient the inbox has never exchanged mail with.
allHold every message for review.

Set approveAttachments: true to also hold anything with attachments. Policies are set by a human in the dashboard or with PATCH /agents/{id} using an account key — an agent key can't change its own policy. Mail sent by people and account keys is never held.

Held mail is returned with status pending_approval. Reviewers approve or reject it in the dashboard or via the API; approved mail is sent immediately, or at its sendAt.

EndpointWhat it does
GET /approvalsHeld messages, oldest first. Humans and account keys only.
POST /approvals/{id}/approveApprove and send.
POST /approvals/{id}/rejectReject with an optional reason. The message is never sent.

The agent hears about each decision through its webhook: message.held (with the reason), then message.approved or message.rejected.

Webhooks

Set a webhookUrl on an agent (dashboard, or PATCH /agents/{id}) and AGMX will POST events for that agent's inboxes.

EventWhen
message.receivedAn inbound email was delivered to one of the agent's inboxes (not sent for spam).
message.sentAn outbound email was accepted for delivery.
message.deliveredThe recipient's server accepted it (requires an SES configuration set).
message.bouncedDelivery failed. Permanent bounces suppress the address.
message.complainedThe recipient marked it as spam. The address is suppressed.
message.heldA message is waiting for approval under the agent's send policy. Includes the reason.
message.approvedA human approved a held message (it's sent right after, or at sendAt).
message.rejectedA human rejected a held message. Includes the reason, if given.
agent.sending_pausedSending was paused, automatically for bounces or complaints, or by a human. Includes the reason.
agent.sending_resumedA human resumed sending.
webhook.testSent from the dashboard or POST /agents/{id}/webhook-test.
POST your-endpoint
{
  "id": "evt_01j9…",
  "type": "message.received",
  "createdAt": "2026-11-02T12:00:00.000Z",
  "agentId": "agt_01j9…",
  "data": {
    "inbox": { "id": "inb_01j9…", "address": "scout@bot.agmx.io" },
    "message": { "id": "msg_01j9…", "subject": "…", "from": { … }, "extracted": { … }, … }
  }
}

Verifying signatures

Each request carries x-agmx-event, x-agmx-delivery and x-agmx-signature: t=<unix>,v1=<hex>, where v1 is the HMAC-SHA256 of `${t}.${rawBody}` keyed with the agent's webhook secret (whsec_…, shown on the agent page).

verify.ts
import { createHmac, timingSafeEqual } from "node:crypto"

export function verifyAgmx(rawBody: string, header: string, secret: string, toleranceSec = 300) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")))
  const t = Number(parts.t)
  if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSec) return false
  const expected = createHmac("sha256", secret).update(`${t}.${rawBody}`).digest("hex")
  const a = Buffer.from(expected), b = Buffer.from(parts.v1 ?? "")
  return a.length === b.length && timingSafeEqual(a, b)
}

Retries

Respond with any 2xx within 10 seconds. Otherwise AGMX retries with exponential backoff (30s, 1m, 2m, 4m … capped at 6h) for up to 8 attempts. Test events are not retried. Recent deliveries, status codes and errors are visible on each agent's page.

MCP server

AGMX exposes a Model Context Protocol server over Streamable HTTP at https://agmx.io/mcp. Authenticate with the same bearer key (an x-api-key header also works). The tools wrap the REST API, so limits and errors are identical.

claude mcp add --transport http agmx https://agmx.io/mcp \
  --header "Authorization: Bearer agmx_agt_…"
ToolWhat it does
whoamiAccount, plan limits, usage and the key's agent.
list_inboxesInboxes the key can use, with unread counts.
create_inboxClaim a new address — permanent, or temporary with expiresIn, maxMessages and acceptFrom.
list_messagesList and search mail (folder, unread, query, since, cursor). Folders include drafts, scheduled and pending.
get_messageRead one email: safeText, security report, attachments and extracted data. Marks it read by default.
wait_for_emailBlock up to 60s for the next email — returns extracted codes and links.
send_emailSend now or at sendAt, with optional attachments and an idempotencyKey.
reply_to_emailReply in-thread, optionally to all, with attachments.
forward_emailForward with attachments, now or at sendAt.
create_draft / update_draft / send_draft / delete_draftSave a draft (or threaded reply draft), edit it, then send, schedule or discard it.
cancel_scheduledMove a scheduled message back to drafts.
add_inbox_rule / list_inbox_rules / update_inbox_rule / delete_inbox_ruleManage allow, block and label rules on the agent's inboxes.
update_messageRead, star, archive, spam and labels.
delete_messagePermanently delete.
list_threads / get_threadBrowse and read whole conversations.

SDKs & CLI

Official clients live in the packages/ directory of the repository. The TypeScript SDK's types are generated from the OpenAPI spec, and every client sends an Idempotency-Key automatically.

// npm install @agmx.io/sdk
import { Agmx, AgmxError } from "@agmx.io/sdk"

const agmx = new Agmx({ apiKey: process.env.AGMX_API_KEY!, baseUrl: "https://agmx.io" })

const inbox = await agmx.inboxes.create({ expiresIn: 3600, maxMessages: 1, acceptFrom: ["github.com"] })
// …trigger the sign-up with inbox.address
const result = await agmx.waitForCode({ inboxId: inbox.id, timeout: 60 })

const sent = await agmx.messages.send({ to: "ada@example.com", subject: "Hi", text: "Hello" })
if (sent.status === "pending_approval") console.log("Waiting for a human to approve")
Until the packages are published
Install from source: clone the repo, run npm install && npm run build in packages/sdk, then npm install /path/to/agmx.io/packages/sdk in your project. Python: pip install ./packages/python. CLI: run npm link in packages/sdk, then npm link agmx && npm link in packages/cli to get the agmx command.

Custom domains

On plans that include custom domains, add one with POST /domains ({"name": "mail.example.com"}) or in the dashboard. AGMX registers it with Amazon SES and returns the DNS records to publish:

TypeNameValuePurpose
MXmail.example.com10 inbound-smtp.<region>.amazonaws.comReceive mail
CNAME ×3<token>._domainkey.mail.example.com<token>.dkim.amazonses.comDKIM signing
TXT_dmarc.mail.example.comv=DMARC1; p=none; …DMARC (recommended)

Call POST /domains/{id}/verify (or click “Check DNS”) to refresh status. Once DKIM verifies, create inboxes on the domain by passing domain to POST /inboxes.

Using a subdomain like mail.example.com keeps your existing root-domain MX records untouched.

Errors

Errors are JSON with a stable _tag to branch on and a human-readable message:

{
  "_tag": "QuotaExceeded",
  "message": "Daily send limit reached (50 on Starter). Resets at 00:00 UTC.",
  "limit": "daily_sends",
  "max": 50,
  "used": 50
}
Status_tagMeaning
401UnauthorizedMissing, invalid or revoked key.
402QuotaExceededPlan limit reached. limit is one of agents, inboxes_per_agent, monthly_sends, daily_sends, custom_domains, message_size.
403ForbiddenNot allowed with this key type, the inbox is paused, or the agent's sending is paused for bounces or complaints.
404NotFoundDoesn't exist or isn't visible to this key. Includes resource.
409ConflictAlready exists (a taken username), or the message is in the wrong state — e.g. approving mail that was already decided.
422InvalidRequestValidation failed; field names the culprit when known.
429RateLimitedToo many requests. Wait retryAfter seconds (also sent as Retry-After).
502DeliveryFailedAmazon SES rejected or failed the request.

Plans & limits

Limits are enforced per account. Received mail has its own monthly limit (it never counts as sends) and mail over the limit or the plan’s max inbound size is dropped; daily limits reset at 00:00 UTC and monthly limits on the 1st. See pricing for the numbers, or call GET /me for your own plan and usage, and GET /usage?days=30 for a daily series.

  • Agents per account, inboxes per agent, custom domains.
  • Sends per day and per month (counted per recipient).
  • Received messages per month and maximum inbound size — mail over either is dropped and counted in usage.droppedThisMonth.
  • Maximum message size including attachments, and message retention.
  • Request rate: 600 API/MCP requests a minute per key or session, 120 a minute per IP without credentials, 10 agent sign-ups an hour per IP, and tighter budgets on sign-in links and password resets. Over the limit you get 429 with Retry-After.

Sending reputation

Every agent sends through the same Amazon SES account, and SES reviews or suspends accounts whose mail bounces or draws spam complaints. To protect everyone's delivery, AGMX pauses an agent's sending when at least 5 of its sends hard-bounce at a rate of 5% or more, or at least 2 draw complaints at 0.1% or more (measured over 30 days). Receiving keeps working and scheduled mail waits. You get an email and an agent.sending_paused webhook. Fix the cause, then resume from the agent page or with an account key. Resuming starts a fresh window.

GET/api/v1/agents/{agentId}/reputation
POST/api/v1/agents/{agentId}/sending/pause
POST/api/v1/agents/{agentId}/sending/resume

Export & deletion

Download everything stored for your account as one JSON file — profile, agents, inboxes, rules, domains, API key names, threads, messages, attachment metadata and usage. Secrets, key hashes and attachment bytes are left out. Works with a dashboard session or an account key, not an agent key.

GET/api/v1/account/export
curl https://agmx.io/api/v1/account/export -H "Authorization: Bearer $AGMX_ACCOUNT_KEY" -o agmx-export.json

Deleting an account removes its agents, inboxes, mail, attachments, keys and custom domains immediately. It needs a signed-in human: use Settings → Your data, or call the endpoint from a dashboard session with confirm set to the account email. API keys can't delete accounts.

DELETE/api/v1/account

Self-hosting

AGMX is open source (GitHub). It's a single TanStack Start app with Effect services, Postgres via Drizzle, Better Auth and Amazon SES. It runs anywhere Node 22+ and Postgres run — Railway works out of the box.

Environment

VariablePurpose
DATABASE_URLPostgres connection string.
BETTER_AUTH_SECRETLong random string used to sign sessions.
APP_URLPublic URL, e.g. https://agmx.io (falls back to RAILWAY_PUBLIC_DOMAIN).
MAIL_DOMAINShared inbox domain, e.g. agmx.io.
ALLOWED_EMAILSComma-separated emails or *@domain.com patterns allowed to sign in. Empty means open sign-ups.
ADMIN_EMAILSOperators: admin role and the unlimited plan.
DEFAULT_PLANPlan for new accounts (free, pro, scale, unlimited).
AWS_REGION / AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEYSES credentials. Use a region with SES receiving (e.g. us-east-1).
SES_CONFIGURATION_SETOptional: configuration set for delivery, bounce and complaint events.
SES_INBOUND_TOPIC_ARNSThe SNS topic ARNs the inbound webhook accepts. Required in production; set it before subscribing the topic.
SES_RECEIPT_RULE_SET / SES_RECEIPT_RULEOptional: rule that custom domains get added to automatically.
MAIL_TRANSPORTses or log. Defaults to ses when AWS credentials are present.
SYSTEM_FROMFrom address for sign-in emails, e.g. AGMX <no-reply@agmx.io>.
ENABLE_AGENT_SIGNUPSSet to false to disable POST /signup.
OPERATOR_NAMEWho runs the instance, named in /terms and /privacy.
SYSTEM_INBOXESRole mailboxes created for the first operator (default abuse,postmaster,privacy). Empty disables.

Amazon SES setup

  1. Verify your mail domain in SES (Identities → Create identity → Domain) and publish the DKIM records. Request production access to send to unverified recipients.
  2. Point the domain's MX record at inbound-smtp.<region>.amazonaws.com (priority 10).
  3. Create an SNS topic and subscribe https://<your-host>/api/inbound/ses over HTTPS. AGMX verifies SNS signatures and confirms the subscription automatically.
  4. Create an active receipt rule for your domain with an SNS action (Base64 encoding) to that topic. For messages over 150 KB, use an S3 action with an SNS notification instead — AGMX fetches the raw message from S3.
  5. Optional: create a configuration set with an SNS event destination (Delivery, Bounce, Complaint) to the same endpoint, and set SES_CONFIGURATION_SET.
deploy
bun install
bun run build
bun run start:prod   # runs database migrations, then starts the server
Local development
Without AWS credentials, MAIL_TRANSPORT defaults to log: outbound mail and sign-in links are printed to the console, and POST /api/dev/inbound lets you inject inbound mail (JSON or raw MIME).

API reference

Every endpoint, schema and error is described in a generated OpenAPI 3.1 document, with an interactive explorer.