Quickstart
The first email takes about ten minutes: one API key, one domain, one inbox, one webhook.
1. Create an API key
Sign in to the dashboard and create a key with the scopes your integration needs. The key is shown once.
export AMB_KEY="amb_live_..."
export AMB_API="https://api.agentmailbox.app"
Every request carries it as a bearer token:
curl "$AMB_API/v1/me" \
-H "Authorization: Bearer $AMB_KEY"
GET /v1/me returns the workspace, subject, scopes, and expiry behind the key. Use it to confirm the key before anything else.
2. Register a domain
curl -X POST "$AMB_API/v1/domains" \
-H "Authorization: Bearer $AMB_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"acme.com"}'
The response includes the DNS records to publish. Add them, then verify the domain:
curl -X POST "$AMB_API/v1/domains/<domain_id>/verify" \
-H "Authorization: Bearer $AMB_KEY"
SPF, DKIM, and DMARC are checked together. An inbox cannot be created on an unverified domain.
3. Create an inbox
curl -X POST "$AMB_API/v1/inboxes" \
-H "Authorization: Bearer $AMB_KEY" \
-H "Content-Type: application/json" \
-d '{"address":"support@acme.com","display_name":"Acme Support"}'const response = await fetch("https://api.agentmailbox.app/v1/inboxes", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AMB_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ address: "support@acme.com", display_name: "Acme Support" }),
});
if (!response.ok) throw new Error(await response.text());
const inbox = await response.json();import os, requests
response = requests.post(
"https://api.agentmailbox.app/v1/inboxes",
headers={"Authorization": f"Bearer {os.environ['AMB_KEY']}"},
json={"address": "support@acme.com", "display_name": "Acme Support"},
)
response.raise_for_status()
inbox = response.json()Retention defaults to the plan. Set retention_mode to zero for receive-only mail that is never stored.
4. Receive the first message
Create a webhook for the events you want:
curl -X POST "$AMB_API/v1/webhooks" \
-H "Authorization: Bearer $AMB_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/hooks/agentmailbox","events":["message.received"]}'
Send an email to the address. The event arrives as a signed POST:
{
"type": "message.received",
"inbox_id": "inx_...",
"message": {
"id": "msg_...",
"thread_id": "thr_...",
"from": "jamie@example.com",
"to": "support@acme.com",
"subject": "Can't update my card",
"text": "The card form keeps failing."
}
}
Verify x-amb-signature before trusting the body. See Webhooks for the signing and replay rules.
5. Reply in the thread
curl -X POST "$AMB_API/v1/messages/<message_id>/reply" \
-H "Authorization: Bearer $AMB_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Thanks for flagging it. I have reset the card form on your account."}'await fetch(`https://api.agentmailbox.app/v1/messages/${messageId}/reply`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.AMB_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
text: "Thanks for flagging it. I have reset the card form on your account.",
}),
});import os, requests
requests.post(
f"https://api.agentmailbox.app/v1/messages/{message_id}/reply",
headers={"Authorization": f"Bearer {os.environ['AMB_KEY']}"},
json={"text": "Thanks for flagging it. I have reset the card form on your account."},
).raise_for_status()The reply leaves from the same address and keeps the thread headers, so the customer sees one conversation.
Next
- Inboxes and threads — addresses, retention, attachments.
- Webhooks — signatures, retries, deduplication, replay.
- Channels — bind Gmail or Telegram to an inbox.
- API reference — every endpoint from the contract.