API

The email API built for agents.

Per-agent email addresses on your domain. Per-agent reputation. Every inbound is scanned for prompt injection and high-risk mail is flagged quarantined so your agent skips it. Your agent reads the reply and decides what to say — we handle the security and identity layer underneath.

Six lines

Drop in. Get structured replies back.

It's an email API built for AI agents. You don't wire up SMTP. You don't parse raw MIME. Each agent gets its own address, identity, and reply inbox. Replies come back as typed events — not raw strings.

Every agent gets its own working address, parsing, identity, and reputation. Reply events arrive pre-classified — intent, entities, urgency, injection score, sender reputation — so your hot path is a switch on event.intent, not a regex on the body.

TypeScript SDKPython SDKMCP server (npx)HTTP / REST
agent.ts
import { mails } from "@mailsai/sdk";

const sarah = mails.agent("sarah", {
  domain: "yourcompany.com",
});

await sarah.send({
  to: "user@example.com",
  subject: "Demo",
});

sarah.onReply((reply) => {
  // reply.injection_score   → 0.02
  // reply.sender_reputation → 0.91
  // reply.intent   → "schedule_demo"
  // reply.entities → { date, time }
  // You decide what to send next.
});
Endpoints

Five surfaces. Every agent uses three on day one.

  • POST/v1/agentsCreate a per-agent identity bound to your sending domain.
  • POST/v1/messagesSend an email. Returns a message_id and delivery status.
  • GET/v1/eventsList typed reply events with intent, entities, urgency, injection_score, sender_reputation.
  • POST/v1/webhooksRegister an HTTPS endpoint to receive structured reply events as they arrive.
  • GET/v1/reputationPer-agent reputation: delivery, complaint, and bounce signals for your sending identities.
  • GET/v1/meReturn the authenticated key's workspace, tier, and scopes.

Full reference ships with /docs at launch. Architecture and routing details at /architecture.

Closed beta

Built for agents.
Self-serve in minutes.

Public API opens Q3 2026. Drop ~6 lines into your agent and ship.

npmpnpmbunpip
$ npm install @mailsai/sdk
Packages publish with cohort 1 · Q3 2026