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"}'

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."}'

The reply leaves from the same address and keeps the thread headers, so the customer sees one conversation.

Next