All solutions
Solutions

Inbound Email API for AI Agents

Receive email as parsed, injection-scanned JSON events — no IMAP, no MIME, no polling loops.

An inbound email API for AI agents turns receiving mail into an event stream: each message to your agent’s address is parsed into clean JSON — sender, subject, text body, thread id — scanned for prompt injection, and delivered to your webhook. Your agent handles a POST request, not a mailbox.

Receiving is an event, not a mailbox

IMAP polling, OAuth refresh, MIME multiparts — none of it belongs in an agent loop. Give the agent its own AI email address, register a webhook, and inbound mail becomes the same shape as every other event your code consumes:

curl "https://api.mails.ai/v1/events?event_type=message.received&limit=50" \
  -H "Authorization: Bearer $MAILS_API_KEY"

Each event carries the parsed message: who sent it, the subject, the clean text body, and the thread it belongs to — so replies land in context and your agent never reconstructs a conversation from raw headers.

Safe by default, priced by volume

Parsing and prompt-injection scanning come with every inbound message on every plan, and inbound has its own allowance — 3,000 inbound replies a month on Free, 50,000 on Pro ($20/month), 500,000 on Scale ($99/month). On paid plans, an optional intent/entity classification step runs at no extra charge when you want routing decided before the LLM runs. Send replies from the same agent — self-serve, billed monthly or yearly.

Replies ride the same managed reputation ramp as any other send. When a workload outgrows the shared pool, at a steady 300,000 or so messages a month, a dedicated IP is available on request on the Scale plan. It warms with your real mail, not a manual schedule: see automated dedicated IP warm-up.

Evaluating alternatives before committing? See the AgentMail vs Mailgun for inbound AI email automation comparison — it covers where each platform fits and where the typed-event + injection-scanning layer makes the difference.

Building in Python? The email API with webhooks for inbound messages — Python AI agents page covers Flask and FastAPI handler patterns, HMAC signature verification, and async webhook acknowledgement specific to Python runtimes.

For the full bidirectional picture — sending and receiving under one key — see the email API for AI agents overview.

Frequently asked questions

Do I need to parse MIME or strip HTML myself?
No. Parsing is the product: you receive the clean plain-text body alongside the structured metadata, which is exactly what you want to hand an LLM. Raw content stays available when you need it.
What about prompt injection hidden in incoming email?
Every inbound message within your plan’s limits is scanned before delivery and flagged in the payload, so untrusted instructions inside a message can be handled by policy instead of read blindly by your agent.
Webhook only, or can I poll?
Both, plus streaming: register a webhook for push, poll GET /v1/events with filters, or hold open the SSE stream at /v1/events/stream — whichever fits your runtime.

Explore the product

Give your first agent an inbox

Free covers 3,000 emails and 3,000 inbound replies a month, with no card. Upgrade when your agents get busy.

Get your API key