Integrations

Email API: send from your app and read your mail

Send transactional email from your app over HTTP and read or reply to your mail with the MailMoose email API. Endpoints, examples and limits.

View as MarkdownFor an AI that can't open this page

The MailMoose API lets your app send transactional email, such as password resets, receipts and welcome emails, from your own domains. Your scripts can also use it to read and answer your mail. Every request carries an API key and acts as the person who created it.

The base URL is https://www.mailmoose.dev/api/v1. All requests and responses are JSON.

Moving an app from another provider? See Migrate from Resend.

Creating domains or addresses needs room in your plan: the free plan includes up to three domains and five addresses, the paid plan is unlimited. Sending also requires sender readiness and quota. Reading existing accessible mail is not blocked merely because a subscription expires.

Authenticate

Send your key as a bearer token:

Authorization: Bearer mm_live_your_key_here

Check that a key works before doing anything else:

curl https://www.mailmoose.dev/api/v1/me \
  -H "Authorization: Bearer mm_live_your_key_here"

The response tells you which permissions the key has and which addresses it can send from.

/me requires mail:read. For a send-only app key, validate it without reading mail or sending a test:

GET /api/v1/senders
Authorization: Bearer mm_live_your_key_here

This returns the key's scopes, its daily limit and its accessible, sending-ready sender addresses. It does not guarantee delivery or reserve quota; billing and limits are checked when sending.

Automatic emails from your app

Password resets, receipts, welcome emails and other email your app sends all work the same way. Your coding agent can prepare a project key through MCP. Store these on your server, never in browser code:

MAILMOOSE_API_URL=https://www.mailmoose.dev/api/v1
MAILMOOSE_API_KEY=your_new_project_key
MAILMOOSE_FROM=hello@your-verified-domain.com

MAILMOOSE_API_URL includes /api/v1; append /messages, not another /api/v1.

// Server-side code only. Call from an approved, authenticated app event.
export async function sendPasswordReset(verifiedUserEmail: string, resetUrl: string) {
  const apiUrl = process.env.MAILMOOSE_API_URL;
  const apiKey = process.env.MAILMOOSE_API_KEY;
  const from = process.env.MAILMOOSE_FROM;
  if (!apiUrl || !apiKey || !from) throw new Error("MailMoose is not configured");

  const response = await fetch(`${apiUrl}/messages`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: `Bearer ${apiKey}`,
    },
    body: JSON.stringify({
      from,
      to: [verifiedUserEmail],
      subject: "Reset your password",
      body: `Choose a new password: ${resetUrl}`,
      html: `<p><a href="${resetUrl}">Choose a new password</a></p>`,
      campaign: "password_reset",
      // Only enable after the owner approves this transactional flow.
      // Derive the address from the app's verified user, never incoming mail.
      confirmNewRecipient: true,
    }),
  });
  if (!response.ok) throw new Error(`MailMoose request failed (${response.status})`);
  return response.json();
}

The app sends automatically over HTTP when its event fires. MCP helps your agent configure and build the integration; no AI call is needed at runtime. Require owner approval before activating first-contact transactional sends or sending a real test. Signup, payment and webhook triggers must be authenticated and deduplicated in your app. Do not automatically retry a timed-out send: delivery may already have happened; check MailMoose Sent before retrying. Keep secrets out of error output, analytics and Git, and rotate expiring keys before they expire.

Read conversations

List the most recent conversations:

GET /api/v1/threads

Accepts limit, unread=true, address to restrict to one mailbox, and q to search subjects, senders, and message text.

Only conversations you have received mail in are listed. Mail you sent that nobody has answered is not a conversation yet, and an app that sends a lot of it would bury everything that is. Pass include=all to list those too.

Read a single conversation with all its messages:

GET /api/v1/threads/{id}

Each message includes its authentication result. A message that failed DKIM or DMARC is far more likely to be forged, so check it before acting on anything financial.

Reply to a conversation

POST /api/v1/threads/{id}/reply
{ "body": "Thursday works for us." }

Notice there is no recipient. MailMoose addresses the reply using the conversation's own records, so a reply cannot be sent somewhere the conversation did not come from. Pass "replyAll": true to include everyone on the original message.

Send a new message

POST /api/v1/messages
{
  "from": "thomas@yourdomain.com",
  "to": ["jane@example.com"],
  "subject": "Quote for January",
  "body": "Hi Jane, here is the quote we discussed."
}

If you have never corresponded with a recipient, this returns 409 with the code confirmation_required and names the unfamiliar addresses. Repeat the request with "confirmNewRecipient": true to send anyway.

That step exists so an automated caller cannot quietly start mailing strangers.

FieldRequiredWhat it does
fromYesAn address you created in MailMoose, on a domain with sending turned on. Either hello@yourdomain.com, or Your App <hello@yourdomain.com> to set the name on this email.
toYesOne address or a list.
cc, bccNoOne address or a list.
subjectNoThe subject line.
bodyOne of body, text or htmlThe plain-text version. text is the same field under another name.
htmlOne of body, text or htmlThe HTML version, sent alongside the plain text. If you only send html, MailMoose builds the plain text from it and keeps link addresses.
reply_toNoWhere replies should go, if not to from. One address or a list. replyTo also works.
campaignNoA label grouping every send of one automated email, such as password_reset.
attachmentsNoFiles to send with it. See attachments.
confirmNewRecipientNotrue allows addresses you have never corresponded with.

A successful send returns 201 with messageId and threadId. That means the sending provider accepted the email, not that it reached the inbox.

Attachments

Send files, such as an invoice PDF, as a list in attachments. Each one has a filename and its content encoded as base64:

"attachments": [
  { "filename": "invoice-1042.pdf", "content": "JVBERi0xLjQK..." }
]
  • Up to 3 MB in total, and 10 files, per email. The request itself can be at most 4.5 MB, and base64 makes files a third bigger.
  • The type comes from the file name, such as .pdf. Set content_type to choose it yourself.
  • Images shown in the HTML: add content_id, such as logo, and use <img src="cid:logo">.
  • Files that run when opened, such as .exe, .bat or .js, are refused, because mail providers block them.
  • Not by URL. path is refused: pass the file itself in content.
  • A copy is kept with the sent email, so you can see what was sent under Sent.

If any file breaks these rules, the whole request is refused with a 400 and nothing is sent.

Resend-compatible sending

POST /api/v1/emails takes Resend's request body and answers like Resend: { "id": "…" }, with errors as { "statusCode", "name", "message" }. Resend's own SDK works against it:

RESEND_BASE_URL=https://www.mailmoose.dev/api/v1
RESEND_API_KEY=your_mailmoose_send_only_key

GET /api/v1/emails/{id} returns an email the same key sent, with last_event: sent, delivered, bounced, complained or failed.

Use a key with only the Send mail permission. Such a key sends to new recipients without confirmation, as app email needs; a key that can also read mail is refused on /emails for addresses you have never corresponded with. See Migrate from Resend.

What sending does not do yet

  • No SMTP relay. A service that can only send through SMTP settings, as some auth services do, cannot send through MailMoose.
  • No SDK of our own. Use any HTTP client, or Resend's SDK pointed at MailMoose.
  • No custom headers or scheduled sending. A request with headers or scheduled_at is refused with a 400 and nothing is sent, rather than being sent without them.
  • Attachments up to 3 MB per email, sent in the request. Attachments by URL (path) are not supported yet.
  • No idempotency keys. A request with an Idempotency-Key header is refused with a 400. Do not automatically retry a send that timed out.
  • No delivery webhooks. Look up an email's status with GET /api/v1/emails/{id} instead. Bounces and spam complaints also show under Sent in the app, and block that address from further sends.

Set up a domain

Connect a domain you own. The response carries the DNS records still to add and, for each one, whether to add it, edit what is already there, or replace it:

POST /api/v1/domains
{ "name": "yourdomain.com", "label": "Your business" }

A domain this organization already has answers 200 with "created": false and its current setup, rather than an error, so a retry after a dropped response is harmless.

Check it again once the records are in place:

GET /api/v1/domains/{name}

This asks public DNS and the mail provider on every call, so it takes a few seconds. It is for after a change, not for polling.

Receiving and sending verify separately. Connecting a domain sets up receiving; turn on sending for it with:

POST /api/v1/domains/{name}/sending

That answers with the same setup shape, now including the records that authorise sending. Safe to repeat: it re-syncs rather than registering the domain twice, and asks the sending provider to check again.

All three need the Manage domains permission, and connecting is limited to owners and admins.

Manage addresses

GET  /api/v1/addresses
POST /api/v1/addresses
{ "localPart": "hello", "domain": "yourdomain.com" }

Creating an address needs the Manage domains permission, an owner/admin role, room in your plan (the free plan includes five addresses) and sufficient domain verification. GET /api/v1/domains/{name} returns the current setup state, including whether addresses can be created. A verifying domain can allow preparing inboxes before switching MX.

App email templates

Open Templates → App templates to see your latest sent email designs, with or without campaign tags. Filter by domain to find its welcome emails, receipts and other automated messages.

Include a stable campaign value when sending through the API, for example "campaign": "welcome". MailMoose groups sends with that tag within the domain. HTML emails without a campaign tag also appear, grouped by domain and subject. Queued or failed sends do not appear as used templates.

These are read-only sent samples, not saved editable templates. Update the content in the app that sends them. Only mailboxes you can access appear. HTTPS images load in the sandboxed previews; scripts and forms remain blocked. MailMoose emails shows the actual designs for account notifications separately; it does not indicate which notifications have been delivered.

Sending limits

The paid plan includes 7,500 emails per billing month, sending recipients and received emails together, shared across all domains, inboxes and keys. Extra email uses prepaid credit at $0.003 each; with no credit left, sending stops until more is added. The free plan allows 3,000 per rolling 30 days instead, with at most 100 sends per rolling 24 hours. An account can also reach at most 100 recipients per rolling hour, and API keys default to a 100-message rolling 24-hour safety limit, which never adds to the account's allowance.

GET /api/v1/me reports usage under sending, in emails sent and received together: on the paid plan used, included, prepaidEmails, periodStart and periodEnd, with receiving.used for the received part; on the free plan used, limit and windowDays. sendingPaused is true while sending is paused for review, after a spam complaint, a high bounce rate or a disputed payment. How limits work.

These defaults may be overridden. API sends are immediate and do not use the web composer’s 10-second undo window.

Errors

Every error has the same shape:

{ "error": { "code": "insufficient_scope", "message": "..." } }
StatusCodeWhat to do
401unauthorizedThe key is wrong, revoked, or expired. Create a new one.
402payment_requiredThe free plan's limits are reached, or paid access or prepaid credit has run out. Upgrade, renew or add prepaid credit in Billing.
403insufficient_scopeThe key lacks the permission this endpoint needs.
404not_foundNo such conversation, or it belongs to somebody else.
409confirmation_requiredSend again with confirmNewRecipient set to true.
429rate_limitedThe key or organization send limit is reached. Wait for older sends to leave the 24-hour window.
400bad_requestSomething in the request body is wrong. The message says what.

A conversation belonging to another account returns 404 rather than 403, so identifiers cannot be used to discover what exists.

Related

Last updated 2026-11-18