An email API for testing signups and codes

Create an inbox, run your signup, read the email. Each message arrives with its verification code and links already picked out.

GET /inboxes/ci-4ba816@…/messages200 OK

Your sign-in code no-reply@example.com · 95 seconds ago

482913

Confirm your email hello@example.com · 2 minutes ago

1 link
Example messages, as the API returns them.

The last part of your app still tested by hand

Signup confirmations, password resets and one-time codes are hard to test without an inbox your code can read. Mailrexo gives you one.

Inboxes on demand
Create one inbox, or 50 with random names in a single request. They receive mail at once.
Codes already found
Every message carries a code field with the likely verification code, and a full message lists its links.
Webhooks instead of polling
A signed POST reaches your server when mail arrives, or when an inbox is created or deleted. From Pro.
Your own domain
Use a premium Mailrexo domain, or create inboxes on your own domain with catch-all turned on.
Keys you control
Read-only or read-write, an IP allow list and an expiry date, set per key.
Clean runs
Delete a message, empty an inbox, or remove the inbox with all its mail when the run ends.

From signup to code in four steps

Every request sends your key in the Authorization header and gets JSON back.

  1. Create a keyOn the Developer page of your dashboard.
  2. Create an inboxPOST to /inboxes with a domain and get a fresh address back.
  3. Run your signupUse that address in your app, from the test.
  4. Read the mailList the inbox and use the code or a link.
curl -X POST "https://api.mailrexo.com/inboxes" \
  -H "Authorization: Bearer $MAILREXO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"domain": "vip.mailrexo.com", "prefix": "ci", "retention": 7}'

curl "https://api.mailrexo.com/inboxes/ci-4ba816@vip.mailrexo.com/messages" \
  -H "Authorization: Bearer $MAILREXO_API_KEY"

Endpoints

Nine endpoints cover inboxes, messages and attachments. Every field and error is in the API docs.

RequestWhat it does
GET /inboxesList your inboxes with message and unread counts
POST /inboxesCreate one inbox, or up to 50 with random names
DELETE /inboxes/{address}Delete an inbox with all its mail
GET /inboxes/{address}/messagesList messages, filtered by since or unread
DELETE /inboxes/{address}/messagesEmpty an inbox
GET /messages/{id}Read one message with its text, HTML, links and attachments
GET /messages/{id}/attachments/{filename}Download an attachment
PATCH /messages/{id}Mark a message read or unread
DELETE /messages/{id}Delete a message

Waiting for a code

Without webhooks, poll the inbox every few seconds. Every 3 seconds is about 20 requests a minute per inbox, so plan how many tests run in parallel.

async function waitForCode(address, timeoutMs = 60000) {
  const url = `https://api.mailrexo.com/inboxes/${encodeURIComponent(address)}/messages`;
  const headers = { Authorization: `Bearer ${process.env.MAILREXO_API_KEY}` };
  const deadline = Date.now() + timeoutMs;

  while (Date.now() < deadline) {
    const response = await fetch(url, { headers });
    const data = await response.json();
    if (!data.success) throw new Error(data.error);

    const mail = data.emails.find((email) => email.code);
    if (mail) return mail.code;
    await new Promise((resolve) => setTimeout(resolve, 3000));
  }
  throw new Error(`No code reached ${address} in time`);
}

Keep the key on your test runner or CI server, never in front-end code.

Webhooks

From Pro. Add an endpoint on the Webhooks page, pick its events, and check the delivery history when a test fails.

email.received
New mail arrived in one of your inboxes.
inbox.created
An inbox was created, in the dashboard or through the API.
inbox.deleted
An inbox was deleted with its mail.

Limits by plan

Over the limit, the API answers 429 with a Retry-After header. Every plan is on the pricing page.

PlanRequests a minuteInboxes per requestWebhooksRetention
Premium1001—Up to 30 days
Pro1,000Up to 50YesUp to 90 days
Business10,000Up to 50YesUp to 180 days

What teams use it for

New to testing email? Start with temporary email for QA testing.

End-to-end signup tests
Signup, email confirmation and password reset, in every build.
Code delivery checks
One-time codes arrive, and arrive fast enough.
Template reviews
Welcome series and transactional mail checked before a release. For campaigns, see newsletter testing.
Workflows
Incoming mail starts a Zapier, Make or n8n workflow. See email to webhook.
Client funnels
One inbox per client or campaign, read by your agency’s tests.

Questions

Which plans include the API?

Premium, Pro and Business. Premium allows 100 requests a minute, Pro 1,000 and Business 10,000. Webhooks and creating up to 50 inboxes in one request start on Pro.

Can I send email with the API?

No. Mailrexo only receives mail. Use the API to read the mail your app sends to Mailrexo addresses.

Does the API work with free temp mail addresses?

No. An API key reaches only the inboxes of its own account, so create test inboxes on your account, on a premium domain or your own domain.

How do I wait for an email in a test?

Poll List messages with the since parameter set to the last message id you saw, every few seconds, until a message arrives. On Pro and Business, the email.received webhook tells your server the moment it does.

How is my API key protected?

Each key can be read-only or read-write, limited to a list of IP addresses, and given an expiry date. Keep it on your server: a key in front-end code can be read by anyone.

How do I check that a webhook came from Mailrexo?

Every request carries an X-Mailrexo-Signature header: an HMAC-SHA256 of the body made with your signing secret. Compute it yourself, compare, and reply with a 2xx status within 4 seconds.

More from Mailrexo

Put your email flows under test.

Get Pro