Skip to Content
MailroomMailroom home

API quickstart

Send and receive with the REST API in a few minutes.

Prefer no code?

Get started sets up an agent in the dashboard and connects it to Claude Code. This page is for calling the API yourself.

1. Get a key

In the dashboard, open API keys (a workspace key) or an agent's page (a key for that agent only). Keys are shown once.

PrefixWhat happens
mr_live_…Real delivery through Amazon SES.
mr_test_…Sandbox. Nothing leaves Mailroom; messages appear in Dev inbox. Use in CI.
export MAILROOM_API_KEY=mr_live_…   # never commit it

2. Send

from must be on your managed subdomain (<anything>@your-workspace.mailroomapi.com) or a domain you verified.

curl -X POST https://api.mailroomapi.com/v1/emails \
  -H "Authorization: Bearer $MAILROOM_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "from": "Riley <riley@your-workspace.mailroomapi.com>",
    "to": ["you@example.com"],
    "subject": "Hello from Mailroom",
    "text": "It works."
  }'

The response is 202 with an id and a status: queued, sent, or pending_approval if the agent's rules hold it for you. Follow it with GET /v1/emails/{id}.

3. Receive

Mail to an agent's address lands in its inbox as a conversation:

curl "https://api.mailroomapi.com/v1/threads?status=open" \
  -H "Authorization: Bearer $MAILROOM_API_KEY"

curl -X POST https://api.mailroomapi.com/v1/threads/thr_…/reply \
  -H "Authorization: Bearer $MAILROOM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Thanks, looking into it now."}'

To hear about new mail instead of polling, add a webhook.

4. TypeScript SDK

The mailroom SDK is not on npm yet; install it from the repo (packages/mailroom), or use fetch as in Connect your agent.

import { Mailroom } from "mailroom";

const mailroom = new Mailroom({ apiKey: process.env.MAILROOM_API_KEY!, baseUrl: "https://api.mailroomapi.com/v1" });
const { data, error } = await mailroom.emails.send({
  from: "riley@your-workspace.mailroomapi.com",
  to: ["you@example.com"],
  subject: "Hello",
  text: "From the SDK.",
});

Next

On this page