Skip to content
AgentMail
AgentMail
Concepts

How AgentMail is architected

See how inboxes own messages, threads, and drafts, then learn the advanced pod and API key scope rules.

AgentMail centers on inboxes. Create an inbox, then send, receive, read, and organize the messages, threads, and drafts it owns. Start with the Quickstart if you have not created an inbox yet.

Start with an inbox

An inbox is an email address. Every message, thread, and draft belongs to exactly one inbox.

Inbox                         an email address
├── Messages                  individual emails
├── Threads                   grouped conversations
└── Drafts                    unsent messages

Use an inbox when you send or receive email. It is the resource your application reads from and writes to.

Use the supporting primitives

PrimitiveWhat it isWhat it belongs to
DomainA sending and receiving domain you own and verifyPod
API keyA credential scoped to an organization, pod, or inboxOrganization, pod, or inbox
WebhookAn HTTP endpoint AgentMail calls on eventsOrganization, pod, or inbox
WebSocketA live connection that streams events for inboxes within the key’s scopeThe level your key is scoped to
LabelA tag on messages and threads. AgentMail manages system labels such as sent, received, and bounced.Inbox
ListAn allow or block list of addresses or domains for sending, receiving, or replyingOrganization, pod, or inbox

Advanced: pods and key scope

An organization is your account. It can contain pods, and each pod contains inboxes. Use pods when your product needs isolated inboxes for separate customers or tenants.

Organization
└── Pod
    └── Inbox

Most integrations use a pod-scoped key. The key selects its pod automatically, so inbox requests do not include a pod in the path. An organization-scoped key can access multiple pods and must name the target pod for pod-level resources, for example /v0/pods/{pod_id}/inboxes. Request paths never include an organization segment because the key identifies the organization.

Key scopePod in the path?
Pod or inboxNo. The key resolves the pod.
OrganizationYes, for pod-level resources.

If you replace a pod-scoped key with an organization-scoped key, update the request path to include the pod. Do the reverse when changing to a pod- or inbox-scoped key.

Check a key’s scope

Run the CLI command below to inspect the current key’s scope.

agentmail auth me

Use curl when the CLI is unavailable.

curl https://api.agentmail.to/v0/auth/me \
  -H "Authorization: Bearer $AGENTMAIL_API_KEY"
Sample response
{
  "scope_type": "pod",
  "scope_id": "<pod_id>",
  "organization_id": "<organization_id>",
  "pod_id": "<pod_id>",
  "api_key_id": "<api_key_id>"
}

scope_type names the key’s level (organization, pod, or inbox) and scope_id is the ID at that level. organization_id is always present; pod_id appears for pod- and inbox-scoped keys, and inbox_id (the inbox email address) only for inbox-scoped keys. api_key_id is present when authentication used an API key and absent for JWT and proxy credentials.

Was this page helpful?Suggest editsRaise issue