BavimailBavimail

Give your AI agent its own email identity

Give an AI agent its own address on your domain with POST /inboxes, receive replies as signed email.inbound.received webhook events, and answer in the same thread with POST /outbound-emails.

Last updated November 25, 2026

In short

  • Create the agent's address: POST /inboxes with {"domain_id": "…", "name": "agent"} on a verified domain. The response carries the inbox id and full_email ([email protected]). SDKs: client.inboxes.create().
  • Receive replies: each message to the address reaches your webhook as a signed email.inbound.received event with email_id, inbox_id, inbox_address, from_email, from_name, subject, body_preview, attachment_count and received_at. GET /inbound-emails/{email_id} returns the full message.
  • Answer in the thread: POST /outbound-emails from the same inbox_id with the message's thread_id and in_reply_to set to its message_id.
  • Price: the Free plan includes 6,000 emails a month (200 a day); the catalog lists no custom-domain allowance on Free. Developer is $5 a month for 10 domains with 10 inboxes each and 50,000 emails a month. About 1,000 inboxes fit on Startup at $50 a month (300 domains, 300 inboxes per domain, 300,000 emails a month); inboxes have no per-inbox charge. Live numbers: pricing.

Why Agents Need Email Identity

Most email APIs assume a human is composing messages. AI agents need:

  • A persistent address: An inbox the agent owns, so replies come back to it.

  • Two-way capability: Send outbound and receive inbound on the same address.

  • Programmatic access: No UI required -- everything via API.

  • Conversation threading: Automatic thread tracking via In-Reply-To and References headers.

5-Line Setup

Create an inbox and send your first agent email (SDK 1.0, npm install bavimail or pip install bavimail):

import { Bavimail } from 'bavimail'

const client = new Bavimail({ apiKey: process.env.BAVIMAIL_API_KEY })
const inbox = await client.inboxes.create({ domainId: 'DOMAIN_ID', name: 'agent' })
const email = await client.emails.send({
  inboxId: inbox.id,
  toEmails: ['[email protected]'],
  subject: 'Your request has been processed',
  body: '<p>Hi, your support ticket #1234 has been resolved.</p>',
})

Your agent now has the address [email protected] (the inbox's full_email) and can both send and receive email. Each plan caps inboxes per domain; past the cap, POST /inboxes answers 400 inbox_limit_exceeded.

Receive Replies and Answer in the Thread

  1. Create a webhook for email.inbound.received: client.webhooks.create() (POST /webhooks with url and event_types). The response carries the signing secret once; store it.
  2. A new webhook is pending_verification. Bavimail posts a signed {"type": "webhook.verification", "verification_code": "…"} challenge to the URL; pass the code to client.webhooks.verify(webhook_id, code). client.webhooks.resend_verification() (resendVerification() in TypeScript) sends a fresh one.
  3. Verify every delivery: X-Webhook-Signature: sha256=<hex> is an HMAC-SHA256 of {X-Webhook-Timestamp}.{raw body} keyed with the hex-decoded secret. The SDKs' verify_webhook_signature / verifyWebhookSignature check it and reject timestamps older than 5 minutes.
  4. Read the event, fetch the message, reply from the same inbox:
{
  "event_id": "…",
  "event_type": "email.inbound.received",
  "timestamp": "2026-11-25T10:00:00.000Z",
  "data": {
    "email_id": "…",
    "inbox_id": "…",
    "inbox_address": "[email protected]",
    "domain_id": "…",
    "from_email": "[email protected]",
    "from_name": "Ada",
    "subject": "Re: Your request has been processed",
    "body_preview": "Thanks, one more question…",
    "attachment_count": 0,
    "received_at": "2026-11-25T10:00:00.000Z"
  }
}

GET /inbound-emails/{email_id} (client.inbound_emails.get() / client.inboundEmails.get()) returns body_text, body_html, reply_to, message_id, thread_id and attachments with signed download URLs. Send the answer with inbox_id, thread_id and in_reply_to; Bavimail writes In-Reply-To and References so the reply stays in the recipient's thread. event_id stays the same across redeliveries, so record it to avoid answering twice.

Complete handlers: FastAPI and Express.

Start Before Your Human Has an Account

An agent does not need a person to sign up first. POST /registrations takes no credentials and answers an API key for a provisional account, so you can configure domains, inboxes, webhooks and test sends immediately and hand the person one link to finish.

curl -X POST https://api.bavimail.com/registrations \
  -H "Content-Type: application/json" \
  -d '{"name": "Shop agent"}'
{
  "registration": {
    "user_id": "user_…",
    "state": "provisional",
    "expires_at": "2026-10-24T12:00:00.000Z",
    "sandbox": { "send_limit": 50, "sends_used": 0, "sends_remaining": 50, "domain_limit": 2, "inboxes_per_domain_limit": 5, "webhook_limit": 3 }
  },
  "api_key": { "key": "ak_…", "name": "Shop agent" },
  "claim": {
    "claim_url": "https://bavimail.com/claim?__clerk_ticket=…",
    "expires_at": "2026-10-24T12:00:00.000Z",
    "instructions": "Give this link to the person who owns the account…"
  }
}

Use api_key.key in the x-api-key header (the same header every other call uses) and build everything. The MCP server exposes the same call as bavimail_register.

What a provisional account can do. Everything except the things that cost money or reach strangers before a person exists:

  • Sends only reach addresses under the account's own verified domains (and their subdomains), up to sandbox.send_limit emails in total. That is enough to exercise the whole send → inbound → webhook loop against your own domain. Anything else answers 403 account_provisional.
  • Domains, inboxes per domain and webhooks are capped by the sandbox limits in the response, and stored bytes (attachments, inbound and outbound message bodies) by sandbox.storage_limit_bytes.
  • The account has no billing until it is claimed: billing status, storage usage, checkout and the billing portal answer 403 account_provisional (the plan catalog stays readable), and nothing is metered. Warmup and tracking domains answer the same.
  • Registrations are rate limited per network and the account is deleted, with everything in it, at expires_at (seven days) unless claimed.

Claiming. Give claim.claim_url to the person. Opening it signs them in to that very account; they add and verify an email address (or connect Google) and the account is theirs: the API key you already embedded keeps working, the limits above disappear, and billing starts on the free plan with what the account already stores counted. GET /registrations/me (bavimail_get_registration) shows state, the sandbox usage and expires_at; POST /registrations/me/claim-link (bavimail_create_registration_claim_link) mints a fresh link if the first one was lost; POST /registrations/me/claim (bavimail_claim_registration) completes the claim once the email is verified and is safe to call repeatedly.

If the person already has a Bavimail account, do not register: ask them to create an API key in the dashboard instead. A provisional account is a separate account and is not merged into an existing one.

Use Cases

Support Agent

An AI agent that monitors inbound email, understands the request, and replies with a resolution or escalates to a human.

Notification Agent

An agent that sends transactional emails (order confirmations, password resets, status updates) triggered by events in your system.

Outreach Agent

An agent that sends personalized outreach email on a schedule, tracks opens and clicks, and adjusts messaging based on engagement.

Workflow Agent

An agent that receives structured data via email (approvals, form submissions, reports) and triggers downstream actions in your pipeline.

AI-Consumable Docs

Bavimail publishes machine-readable documentation for AI agents:

  • /llms.txt : Structured index of all documentation sections.

  • /llms-full.txt : Full documentation content, concatenated for context windows.

Point your agent's retrieval system at these endpoints for up-to-date API reference without scraping HTML.

Can an AI agent own its own email identity?

Yes — that is a first-class workflow. Each agent can get its own inbox on a verified domain (POST /inboxes), send from that inbox, and receive its inbound mail as email.inbound.received webhook events or through GET /inbound-emails?inbox_id=…. See the setup above.

From Bavlio Inc.: Rosefall, the agency · Bavlio, outreach software · Bavimail, email platform