MoeMail now works inside your AI assistant
MoeMail

Temp Mail API

Create a temporary mailbox, wait for the verification email and read the code with four HTTP calls. Private inboxes on your account, keys you can restrict, an OpenAPI document and an MCP server for AI agents.

What the API is for

Sign-up tests, password-reset flows, OTP checks in CI and AI agents that need to receive a code: anything that needs a real address for a few minutes and then a way to read what arrived. The MoeMail REST API does exactly that, under the same account and mailboxes as the web inbox at moemail.app.

Mailboxes are private to your account. Nobody can read them by guessing the address, and a restricted key can be limited to the mailboxes it created itself.

Quick start

Send your key in the X-API-Key header. These four calls are a whole verification round trip; the comments show the real response shapes.

curl · bash
# 1. a mailbox that lives for an hour (expiryTime is in milliseconds)
curl -s https://moemail.app/api/emails/generate \
  -H "X-API-Key: mk_••••••••••••" -H "Content-Type: application/json" \
  -d '{"name":"signup-test","expiryTime":3600000,"domain":"moemail.app"}'
# {"id":"k3f…","email":"signup-test@moemail.app"}

# 2. wait for the verification mail (the server holds the request up to 50 s)
curl -s "https://moemail.app/api/emails/k3f…/wait?timeout=50" -H "X-API-Key: mk_••••••••••••"
# {"messages":[{"id":"m81…","from_address":"no-reply@example.com",
#   "subject":"Your code is 482913",…}],"cursor":"…"}

# 3. read it
curl -s https://moemail.app/api/emails/k3f…/m81… -H "X-API-Key: mk_••••••••••••"
# {"message":{"id":"m81…","content":"Enter 482913 to finish signing up.",…}}

# 4. clean up
curl -s -X DELETE https://moemail.app/api/emails/k3f… -H "X-API-Key: mk_••••••••••••"
# {"success":true}

wait returns as soon as a new message arrives, or after the timeout with an empty list: pass the returned cursor as since and call it again. Every call, waits included, counts as one API call.

The endpoints you need

Everything else is in the OpenAPI 3.1 document the API serves itself, and in the docs.

POST /api/emails/generate
Create a mailbox: name (random when empty), expiryTime in ms and domain. Returns id and email.
GET /api/emails/{id}/wait
Long-poll until a message newer than since arrives (up to 50 s per call).
GET /api/emails/{id}
Messages of one mailbox, newest first, 20 per page with cursor.
GET /api/emails/{id}/{messageId}
One message: subject, text content and html.
GET /api/emails
Your unexpired mailboxes, newest first.
POST /api/emails/{id}/send
Send from one of your mailboxes, if your role has a send quota.
DELETE /api/emails/{id}
Delete a mailbox and everything in it.

Keys you can restrict

Create keys in your profile under API Key Management. A key can be cut down to what a job needs, and the limits are fixed for the life of the key:

  • Actions: any subset of read, create, send and delete. A key without send cannot send mail, whatever your role allows.
  • Only the mailboxes it creates: the key never sees the rest of your account.
  • Requests per day: a ceiling for one key, so a runaway loop stops at a number you chose.
  • Lifetime: from one hour to one year.

A restricted key gets 403 outside its actions and 429 with Retry-After at its daily limit.

No key to copy: moemail login

The CLI can sign in through the browser instead. It prints a link and a short code; you approve it on any device and it saves a new key with the restrictions you asked for.

@moemail/cli · bash
npm i -g @moemail/cli
moemail login --scopes read,create --own-mailboxes --expires 7d --daily-limit 500
# opens a link with a short code; approve it in the browser and the CLI saves the new key

For AI agents: the MCP server

The same API is available as MCP tools at https://moemail.app/mcp. Claude, ChatGPT and Claude Code connect with OAuth: you approve the app once, choose what it may do, and revoke it from your profile. Each connected app gets its own restricted key.

Connect an AI app →

Quota and price

Every request made with a key counts toward your account's monthly quota: 100,000 calls a month for Duke. The default plan includes no API calls; buy an API-call pack or a Duke upgrade in the shop with MoeCoin. When the quota is used up, the API answers 429 with monthlyLimit and monthlyUsed.

Creating mailboxes and reading mail in the web inbox stays free. Sending has its own daily allowance by role, separate from API calls.

Frequently asked questions

The web inbox is free, but API calls are a paid add-on on moemail.app: the default plan includes none. If you need a free route, MoeMail is open source and you can run it on your own Cloudflare account or server, with the same API and no quota of ours.

Yes. The API acts on your account's mailboxes, so you sign up, then create a key in your profile or sign in with moemail login. That account is also what keeps the inboxes private.

Call GET /api/emails/{id}/wait. The server holds the request until a new message arrives or the timeout passes (up to 50 seconds), then you call it again with the cursor it returned. One call per wait, not one per second.

Yes, with POST /api/emails/{id}/send, if your role has a send quota and the key's actions include send. Sending is limited per day by role, separately from API calls.

Yes. The API serves its OpenAPI 3.1 document at https://moemail.app/api/openapi.json, which you can load into Postman, Insomnia or a code generator. The docs list the same routes with examples.

JSON with an error field, for example {"error": "…"}, and the usual status codes: 401 for a missing or wrong key, 403 for an action the key or role may not do, 429 for a quota or rate limit. Send Accept-Language to get the message in one of seven languages.

Yes, two ways: call the REST API from the agent's code, or connect the MCP server at https://moemail.app/mcp, which exposes create, wait, read and delete as tools and signs in with OAuth.

Start with one mailbox

Sign up, create a key, and run the four calls above.

Get an API key