Reference

API basics

One base URL, bearer keys, JSON in and out.

https://api.emailforagents.ai/v1

Keys

Send a project key as a bearer token. The prefix sets the environment, and nothing lets a key cross it.

efa_live_…
Reaches live inboxes in one project
efa_test_…
Reaches test inboxes only
Shown once
Stored as a hash. Lost it? Create a new one and revoke the old.

Safe retries

Give every send an Idempotency-Key. Repeat it within 30 days and you get the first result back, not a second email. The same key with a different body returns idempotency_conflict.

Headers on a send
Authorization: Bearer efa_live_7c1e09ab…
Idempotency-Key: invoice-q3-ap
Content-Type: application/json

Pages

Lists return data, has_more and next_cursor. Pass the cursor back to get the next page. An old cursor answers invalid_cursor (on events, cursor_expired); start again from the first page.

Errors

Every error has the same shape. Retry only when retryable is true, and quote the request_id when you contact support.

403 Forbidden
{
  "error": {
    "code": "policy_denied",
    "message": "Workspace policy blocked this send.",
    "request_id": "req_8Kd2x91",
    "retryable": false,
    "details": { "reason_codes": ["blocked_recipient"] }
  }
}
Every error code

Resources

ResourcePath, under /projects/{project_id}
Inboxes /inboxes
Messages /inboxes/{inbox_id}/messages
Conversations /inboxes/{inbox_id}/threads
Sending rules /inboxes/{inbox_id}/policy
Approvals /approvals
Events /events
Webhooks /webhooks
Uploads /uploads
Domains /domains
Keys /keys
Exports /exports
Simulate mail /test/inbound

Key details

A key is efa_live_ or efa_test_, then 8 hex characters, an underscore and a 43-character secret. The first part names the key in the console; the secret is never shown again.

Create
In the console under Agents, or with POST /projects/{project_id}/keys.
Revoke
In the console, or with POST /keys/{key_id}/revoke. The key stops working on its next request.
Scopes
Picked when the key is made, from the 32 the API defines, and never more than its creator holds. A key can also be limited to some inboxes.
Checked
On every request, against what its creator holds now. Narrow their access and the key narrows with it.
MCP
Refused at the MCP server. Agent clients sign in there with OAuth: see MCP tools.

Requests

Body
JSON, up to 1 MiB. A file’s bytes go up on their own, up to 10 MiB (see Attachments). Anything bigger answers payload_too_large.
Bad input
invalid_request, with details.fields naming each field that didn’t match.
Request ID
Every response carries an x-request-id header. An error repeats it as request_id.
Retryable
True by default for rate_limited, provider_unavailable and temporarily_unavailable; false for every other code unless the response sets it.
SDKs
None published yet. Every example is plain HTTP.
Console
For people, at app.emailforagents.ai: inboxes, approvals, activity, keys, connections and sending rules.

Send results

A send answers 202 Accepted either way, so check result, not the status code.

202 Accepted: queued
{
  "result": "queued",
  "message_id": "msg_2f1c…",
  "thread_id": "thd_9b04…",
  "state": "queued",
  "request_id": "req_7a3e…"
}
202 Accepted: approval_required
{
  "result": "approval_required",
  "draft_id": "drf_5c22…",
  "draft_version": 1,
  "approval_id": "apr_0e8d…",
  "reason_codes": ["always"],
  "request_id": "req_7a3e…"
}

queued means accepted for sending, not delivered. The message moves from queued to submitting to accepted, and accepted means our mail provider took it. Events say what happened next.

approval_required means nothing has been sent. The draft waits in Approvals until a person approves or rejects it, for up to 7 days.

If the provider’s answer to a send is lost, the message’s state is submission_unknown and it is held, not retried. Don’t send it again under a new key: that could deliver it twice.

To reply in a conversation, pass the original’s ID as reply_to_message_id. The API sets In-Reply-To and References from it; you still give the recipients and the subject.

Limits

Checked on every request. Going over answers with an error; nothing is cut short.

LimitValue
JSON request body 1 MiB
Subject 998 characters, on one line
text and html 512,000 characters each
Recipients 25 unique addresses across To, Cc and Bcc
Attachments 10 per message
One attachment 10 MiB
All attachments 15 MiB per message
Incoming message 25 MiB, as received
List page 25 by default (50 for a conversation’s messages), up to 100
Allow and block lists 100 entries each
Idempotency-Key replay 30 days
Idempotency-Key record 365 days. After the replay window a repeat answers idempotency_expired.
Draft waiting for approval 7 days
Reserved upload 24 hours to finish
Webhook test event One every 60 seconds per endpoint

Rate limits

Three counters run in production: 1,200 requests a minute per client IP, 600 a minute per key, connection or signed-in person, and 600 a minute per workspace. Going over answers rate_limited with Retry-After: 60.

Treat them as a ceiling, not a promise. They are Cloudflare counters, local to the location that serves the request: they stop a runaway loop and are never used for billing. Exports and webhook tests have limits of their own (see rate_limited).

Test and live

A project is test or live from the start and stays that way. Its keys and connections reach that environment only.

Compared Test project Live project
Address Generated, on a non-routable .mail.invalid host A real address on agents.emailforagents.ai, or on your own domain
Mail Never leaves. Simulate incoming mail with POST /test/inbound. Real internet mail, in and out
Limits 3 inboxes and 100 sent messages for the life of the workspace, and 10 MiB of content Your plan’s inboxes and email units, and each inbox’s sending rules
Custom domains Not available With Builder or Team

Live mail also counts against your plan. Free is one complimentary live inbox and 100 email units a month per verified owner identity, claimed by the first workspace to use it. Pricing has the plans.

To try the receiving side, a test project can record a message as if it had arrived:

POST /projects/{project_id}/test/inbound
{
  "inbox_id": "ibx_8e7f…",
  "from": { "email": "buyer@example.com" },
  "to": [{ "email": "8e7f…@a1b2….mail.invalid" }],
  "subject": "Invoice 4821",
  "text": "Could you resend the receipt?"
}

Each call records one received message in a new conversation, answers 201 with its id and thread_id, and emits message.received with simulated: true. It needs test:simulate and messages:read, and doesn’t count toward the test limits.

IDs

Every resource ID is a prefix and a UUID. The prefix is checked, so an ID of the wrong kind is never read as another resource. Request IDs are opaque: quote them as they are.

PrefixResource
ws_ Workspace
prj_ Project
ibx_ Inbox
thd_ Thread
msg_ Message
drf_ Draft
apr_ Approval
att_ Attachment
upl_ Upload
dom_ Domain
key_ API key
con_ Connection
evt_ Event
wh_ Webhook
whd_ Webhook delivery
exp_ Export
del_ Deletion job

Version

This is version 2026-09-19 of the API, served under /v1. Every event and every webhook body carries it as api_version, so a consumer can branch on it.

View as Markdown

Search docs