← Back to your inbox

Temporary Email API — Python, Node.js and REST Reference

Create a temporary inbox, send a test email from your own app, and read it with Python, Node.js or HTTP. 10minutesmail operates this API; the free plan includes 50 received emails per UTC day.

10minutesmail ·

OpenAPI JSON · Markdown reference · Python example · Node.js example

Who operates this API

This is the 10minutesmail API, operated by the same service as this website. It is not a resale of another temporary-mail provider's API. Our Cloudflare Worker runs the application, Cloudflare Email Routing delivers incoming email to it, and Cloudflare D1 stores inboxes, messages and usage records. Receiving domains currently include zsou.cc and 10minutemail.im; the service selects the domain when creating an address.

RapidAPI is the marketplace and HTTP gateway. It handles your marketplace key and subscription, forwards requests to our Worker, and returns its responses. Incoming email reaches our service through Email Routing, not through RapidAPI. We count received emails when a new message is stored in D1.

Your Python / Node.js app → RapidAPI gateway → 10minutesmail Worker → D1
Your test sender → Cloudflare Email Routing → the same Worker → D1

The reference below describes our deployed REST API, not Cloudflare's account-management API. The server implementation and the published OpenAPI specification define the protocol; code blocks below use synthetic example data.

Base URL and authentication

Subscribe to a plan on the 10minutesmail RapidAPI listing and use the key and host displayed in its playground.

Client-facing base URL:

https://10minutesmail-temporary-email-api.p.rapidapi.com

Paths in this document are relative to that URL. For example, call https://10minutesmail-temporary-email-api.p.rapidapi.com/domains.

RapidAPI forwards those calls to our origin at https://10minutemail.im/api/public/v1. The origin requires trusted gateway authentication; your consumer key alone cannot call that origin directly. You do not need Cloudflare credentials.

Request headers

Every call requires:

X-RapidAPI-Key: YOUR_RAPIDAPI_KEY
X-RapidAPI-Host: 10minutesmail-temporary-email-api.p.rapidapi.com

Reading or closing a specific mailbox additionally requires:

Authorization: Bearer MAILBOX_TOKEN_FROM_CREATE

The RapidAPI key identifies your marketplace application. The mailbox token grants access to one inbox and is returned only when it is created. They are different credentials. Requests must come from the same RapidAPI consumer that created the mailbox; another consumer cannot use it even with its token. Keep both credentials server-side, out of URLs, browser bundles and logs.

Request and response format

  • Request body: none for all seven operations, including POST. Do not send {}, JSON, form data or query parameters. There is no Content-Type requirement for an empty request.
  • Success response: JSON, except DELETE, which returns an empty 204 response. Do not parse 204 as JSON.
  • Error response: HTTP status plus a JSON error object, as defined below. RapidAPI may return its own gateway error before our service is reached.
  • Identifiers: mailbox and message IDs are 32 lowercase hexadecimal characters. They are IDs, not email addresses.
  • Dates: all numeric timestamps are Unix milliseconds in UTC. X-10MM-Reset is the exception: it uses Unix seconds.
  • Polling: check a mailbox at most once every 15 seconds. The API has no webhook, send-mail or attachment-download operation.

Quick start with cURL

Set these variables in your terminal. Replace the key placeholder with your own key, locally.

export RAPIDAPI_KEY='YOUR_RAPIDAPI_KEY'
export RAPIDAPI_HOST='10minutesmail-temporary-email-api.p.rapidapi.com'

Create an inbox. There is deliberately no --data argument.

curl --fail-with-body --request POST \
  "https://${RAPIDAPI_HOST}/mailboxes" \
  --header "X-RapidAPI-Key: ${RAPIDAPI_KEY}" \
  --header "X-RapidAPI-Host: ${RAPIDAPI_HOST}"

Save id, address, token and accessEndsAt from the 201 response. Send a synthetic test email from your own app to address. Then use the complete Python or Node.js example below to poll, read and close the inbox. cURL prints the creation response, including the token: keep that output private.

Python example

Python 3.10+, standard library only. Download receive.py, set the two environment variables above, then run:

python3 receive.py

The script prints a new address. Send your synthetic message to it while the script waits. It polls eight times at 15-second intervals, prints the first message's subject and text, and attempts to close inbox access in finally, including on failure. Cleanup errors are reported without hiding the original error. Each network call has a 20-second timeout; total runtime can exceed two minutes when requests are slow. The script does not send email or print credentials.

"""Python 3.10+, standard library only. Never print keys or mailbox tokens."""
import json
import os
import re
import sys
import time
from urllib.error import HTTPError
from urllib.request import Request, urlopen

key = os.environ.get("RAPIDAPI_KEY")
host = os.environ.get(
    "RAPIDAPI_HOST", "10minutesmail-temporary-email-api.p.rapidapi.com"
)
if not key or not re.fullmatch(r"[a-z0-9.-]+\.p\.rapidapi\.com", host):
    raise RuntimeError("Set RAPIDAPI_KEY and the marketplace RAPIDAPI_HOST.")


def call(path, method="GET", token=None):
    headers = {"X-RapidAPI-Key": key, "X-RapidAPI-Host": host}
    if token:
        headers["Authorization"] = f"Bearer {token}"
    if method == "POST":
        headers["Content-Length"] = "0"
    # POST deliberately has no data: this API does not accept a JSON body.
    request = Request(f"https://{host}{path}", method=method, headers=headers)
    try:
        with urlopen(request, timeout=20) as response:
            return None if response.status == 204 else json.load(response)
    except HTTPError as error:
        body = error.read().decode("utf-8", errors="replace")
        raise RuntimeError(f"API {error.code}: {body}") from error


mailbox = None
try:
    print("Daily budget:", call("/usage"))
    mailbox = call("/mailboxes", "POST")
    print("Send your own synthetic email to:", mailbox["address"])
    print("Waiting up to two minutes; polling every 15 seconds.")
    for _ in range(8):
        time.sleep(15)
        inbox = call(f"/mailboxes/{mailbox['id']}/messages", token=mailbox["token"])
        if not inbox["messages"]:
            continue
        message_id = inbox["messages"][0]["id"]
        detail = call(
            f"/mailboxes/{mailbox['id']}/messages/{message_id}",
            token=mailbox["token"],
        )
        print("Received test message:", {"subject": detail["subject"], "text": detail["text"]})
        break
    else:
        print("No email arrived during this polling window.")
finally:
    if mailbox:
        had_error = sys.exc_info()[0] is not None
        try:
            call(f"/mailboxes/{mailbox['id']}", "DELETE", mailbox["token"])
            print("Access closed. Backend records are retained.")
        except Exception as cleanup_error:
            print(f"Could not close inbox: {cleanup_error}", file=sys.stderr)
            if not had_error:
                raise

Node.js example

Node.js 22+, no packages. Download receive.mjs, set the two environment variables above, then run:

node receive.mjs

This follows the same create → poll → read → close flow as the Python example, with a 20-second timeout per request. It prints text rather than executing email HTML. Both scripts stop on HTTP errors; use the error reference below before retrying.

// Node.js 22+, no packages. Keys stay in environment variables, never in URLs.
const key = process.env.RAPIDAPI_KEY;
const host = process.env.RAPIDAPI_HOST || '10minutesmail-temporary-email-api.p.rapidapi.com';
if (!key || !/^[a-z0-9.-]+\.p\.rapidapi\.com$/.test(host)) throw new Error('Set RAPIDAPI_KEY and the marketplace RAPIDAPI_HOST.');
const base = `https://${host}`;
let mailbox;
async function call(path, method = 'GET', token) {
  const response = await fetch(base + path, {
    method,
    headers: { 'X-RapidAPI-Key': key, 'X-RapidAPI-Host': host, ...(token ? { Authorization: `Bearer ${token}` } : {}) },
    signal: AbortSignal.timeout(20_000),
  });
  if (!response.ok) throw new Error(`API ${response.status}: ${await response.text()}`);
  return response.status === 204 ? undefined : response.json();
}
try {
  const usage = await call('/usage');
  console.log('Daily budget:', usage);
  mailbox = await call('/mailboxes', 'POST');
  // This example prints the address for your synthetic test sender, never its token.
  console.log('Send your own synthetic email to:', mailbox.address);
  console.log('Waiting up to two minutes; polling every 15 seconds.');
  let received = false;
  for (let n = 0; n < 8; n++) {
    await new Promise(resolve => setTimeout(resolve, 15_000));
    const { messages } = await call(`/mailboxes/${mailbox.id}/messages`, 'GET', mailbox.token);
    if (!messages.length) continue;
    const detail = await call(`/mailboxes/${mailbox.id}/messages/${messages[0].id}`, 'GET', mailbox.token);
    console.log('Received test message:', { subject: detail.subject, text: detail.text });
    received = true;
    break;
  }
  if (!received) console.log('No email arrived during this polling window.');
} finally {
  if (mailbox) {
    try {
      await call(`/mailboxes/${mailbox.id}`, 'DELETE', mailbox.token);
      console.log('Access closed. Backend records are retained.');
    } catch (error) {
      console.error('Could not close inbox:', error.message);
      process.exitCode = 1;
    }
  }
}

REST endpoint reference

All requests below use the base URL and common headers defined above. No operation accepts a request body or query string. Response values are examples, not live inbox credentials. The placeholder MAILBOX_TOKEN_FROM_CREATE represents the real 64-character token returned by creation.

GET /domains — available receiving domains

Parameters: none. Mailbox token: not required. Request body: none.

GET /domains HTTP/1.1
Host: 10minutesmail-temporary-email-api.p.rapidapi.com
X-RapidAPI-Key: YOUR_RAPIDAPI_KEY
X-RapidAPI-Host: 10minutesmail-temporary-email-api.p.rapidapi.com

Response: 200 OK

{
  "domains": ["zsou.cc", "10minutemail.im"],
  "receiveOnly": true
}
  • domains — array of currently enabled receiving-domain strings. Do not hard-code the pool; it may change.
  • receiveOnly — boolean; the service receives mail and does not send it.

The creation endpoint selects an address and domain. There is no custom-address or domain-selection parameter.

POST /mailboxes — create an inbox

Parameters: none. Mailbox token: not required. Request body: none; {} is rejected.

POST /mailboxes HTTP/1.1
Host: 10minutesmail-temporary-email-api.p.rapidapi.com
X-RapidAPI-Key: YOUR_RAPIDAPI_KEY
X-RapidAPI-Host: 10minutesmail-temporary-email-api.p.rapidapi.com

Response: 201 Created

{
  "id": "11111111111111111111111111111111",
  "address": "oliver.reed123456@zsou.cc",
  "createdAt": 1795900000000,
  "countdownEndsAt": 1795900600000,
  "expiresAt": 1795900600000,
  "serverTime": 1795900000000,
  "token": "MAILBOX_TOKEN_FROM_CREATE",
  "accessEndsAt": 1795986400000
}
  • id — string; use it as the mailbox path parameter.
  • address — string; the real receiving email address. Use the returned value, not the example address.
  • token — 64 lowercase hexadecimal characters; returned only in this response. It cannot be retrieved later.
  • createdAt — integer; creation time in Unix milliseconds.
  • accessEndsAt — integer; hard API access deadline, 24 hours after creation. Receipt and reads stop after this time.
  • countdownEndsAt — integer; legacy display-timer value. It does not control API access.
  • expiresAt — integer; alias of countdownEndsAt, also not the hard access deadline.
  • serverTime — integer; server response time in Unix milliseconds.

Store the ID and token together privately. Creating a new inbox does not restore access to an older one.

GET /mailboxes/:id — read inbox metadata

Path parameter: id, from creation. Mailbox token: required. Request body: none.

GET /mailboxes/11111111111111111111111111111111 HTTP/1.1
Host: 10minutesmail-temporary-email-api.p.rapidapi.com
X-RapidAPI-Key: YOUR_RAPIDAPI_KEY
X-RapidAPI-Host: 10minutesmail-temporary-email-api.p.rapidapi.com
Authorization: Bearer MAILBOX_TOKEN_FROM_CREATE

Response: 200 OK

{
  "id": "11111111111111111111111111111111",
  "address": "oliver.reed123456@zsou.cc",
  "createdAt": 1795900000000,
  "countdownEndsAt": 1795900600000,
  "expiresAt": 1795900600000,
  "serverTime": 1795900015000,
  "accessEndsAt": 1795986400000
}

Field types and meanings match creation, without token. An authenticated read after closure or the access deadline returns 410 CLOSED; an unknown ID or wrong token returns 401 UNAUTHORIZED.

GET /mailboxes/:id/messages — list messages

Path parameter: id. Mailbox token: required. Request body: none.

GET /mailboxes/11111111111111111111111111111111/messages HTTP/1.1
Host: 10minutesmail-temporary-email-api.p.rapidapi.com
X-RapidAPI-Key: YOUR_RAPIDAPI_KEY
X-RapidAPI-Host: 10minutesmail-temporary-email-api.p.rapidapi.com
Authorization: Bearer MAILBOX_TOKEN_FROM_CREATE

Response: 200 OK

{
  "messages": [
    {
      "id": "22222222222222222222222222222222",
      "from": "qa@example.net",
      "subject": "Your test code",
      "receivedAt": 1795900010000
    }
  ],
  "countdownEndsAt": 1795900600000,
  "expiresAt": 1795900600000,
  "serverTime": 1795900015000
}
  • messages — array of summaries, newest first; at most 10 messages are accepted per API inbox. An inbox with no mail returns [], not an error.
  • Each summary has id (string), from (sender-address string), subject (string; a missing subject is stored as (No subject)) and receivedAt (Unix-millisecond integer).
  • The list does not include text or html; fetch message detail to read the body.
  • The three top-level timer fields have the same meanings as above. Save accessEndsAt from creation or read metadata for the API deadline.

There is no pagination, filter or since query parameter. Poll no faster than every 15 seconds; cache already-read message IDs in your client.

GET /mailboxes/:id/messages/:messageId — read a message

Path parameters: id (mailbox ID) and messageId (ID from its message list). Mailbox token: required. Request body: none.

GET /mailboxes/11111111111111111111111111111111/messages/22222222222222222222222222222222 HTTP/1.1
Host: 10minutesmail-temporary-email-api.p.rapidapi.com
X-RapidAPI-Key: YOUR_RAPIDAPI_KEY
X-RapidAPI-Host: 10minutesmail-temporary-email-api.p.rapidapi.com
Authorization: Bearer MAILBOX_TOKEN_FROM_CREATE

Response: 200 OK

{
  "id": "22222222222222222222222222222222",
  "from": "qa@example.net",
  "subject": "Your test code",
  "text": "Your test code is 673921.",
  "html": "<p>Your test code is <strong>673921</strong>.</p>",
  "receivedAt": 1795900010000
}

id, from, subject and receivedAt match the summary. text is a string: the plain-text part, or text derived from HTML when necessary. html is a sanitized HTML string, or null when no HTML body was supplied. Attachment files and full raw MIME are not returned.

The message must belong to the authenticated inbox. An unknown message ID in a valid inbox returns 404 NOT_FOUND. Render HTML in a sandboxed viewer; do not inject it as trusted app markup. Remote images can trigger tracking requests. Tests can use text instead.

DELETE /mailboxes/:id — close inbox access

Path parameter: id. Mailbox token: required. Request body: none.

DELETE /mailboxes/11111111111111111111111111111111 HTTP/1.1
Host: 10minutesmail-temporary-email-api.p.rapidapi.com
X-RapidAPI-Key: YOUR_RAPIDAPI_KEY
X-RapidAPI-Host: 10minutesmail-temporary-email-api.p.rapidapi.com
Authorization: Bearer MAILBOX_TOKEN_FROM_CREATE

Response: 204 No Content. Response body: empty. Do not call response.json() on it.

This closes access and stops new deliveries. Backend records remain; this is not physical erasure and there is no recovery endpoint. A repeat call with the valid token returns 410 CLOSED, not another 204. Closing does not refund quota.

GET /usage — daily usage and limits

Parameters: none. Mailbox token: not required. Request body: none.

GET /usage HTTP/1.1
Host: 10minutesmail-temporary-email-api.p.rapidapi.com
X-RapidAPI-Key: YOUR_RAPIDAPI_KEY
X-RapidAPI-Host: 10minutesmail-temporary-email-api.p.rapidapi.com

Response: 200 OK — BASIC example

{
  "plan": "BASIC",
  "period": "UTC calendar day",
  "resetsAt": 1795910400000,
  "limits": {
    "requests": 200,
    "mailboxes": 5,
    "receivedMessages": 50,
    "maxRawMessageBytes": 65536
  },
  "usage": {
    "requests": 7,
    "mailboxes": 1,
    "receivedMessages": 1
  },
  "documentation": "https://10minutemail.im/developers"
}
  • plan — string, BASIC or PRO, supplied through the authenticated gateway.
  • period — string, UTC calendar day; resetsAt is the next midnight UTC in Unix milliseconds.
  • limits — object of integer caps: daily HTTP requests, daily mailbox-creation attempts, daily successfully received messages, and maximum raw bytes per message.
  • usage — object of integers used so far today. receivedMessages counts only newly stored messages, across your API inboxes. Duplicate or rejected deliveries do not count.
  • documentation — URL string for this reference.

Remaining email allowance is max(0, limits.receivedMessages - usage.receivedMessages), subject to the shared safety cap and capacity of each inbox. /usage does not consume our daily request allowance, but it is rate-limited and RapidAPI can still count the call in its own request quota.

Errors and response headers

An error returned by our service has this shape:

{
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Mailbox access has ended. Create a new mailbox."
  }
}

error.code is a machine-readable string. error.message is an explanatory string, not a stable value to match in your code. Use the HTTP status and code.

  • 400 BAD_REQUEST — a query string or nonempty request body was sent. Remove it.
  • 401 GATEWAY_REQUIRED / CONSUMER_REQUIRED — our origin did not receive valid gateway authentication/identity. Use the RapidAPI host and check its playground configuration.
  • 401 UNAUTHORIZED — wrong/missing mailbox token, unknown inbox or a different consumer/channel. A RapidAPI key cannot substitute for the mailbox token.
  • 403 PLAN_UNSUPPORTED — the gateway supplied a subscription tier this API does not support.
  • 404 NOT_FOUND — unknown route/method, or message not found in the authenticated inbox. Check the path and IDs.
  • 410 CLOSED — an authenticated inbox was explicitly closed or its 24-hour API access deadline passed. Create another inbox for a new test.
  • 429 RATE_LIMITED / DAILY_QUOTA / SERVICE_QUOTA — minute, daily request/creation, or shared service request/creation limits. Wait for the supplied Retry-After (seconds); do not retry in a tight loop or rotate identities to evade caps.
  • 503 NOT_CONFIGURED / UNAVAILABLE — service configuration or infrastructure failure. Retry with bounded exponential backoff; a failed POST might have created an inbox before a network failure, so it is not guaranteed safe to replay without consuming another creation attempt.

Successful metered calls return X-10MM-Request-Limit (integer daily request cap), X-10MM-Requests-Remaining (integer remaining requests) and X-10MM-Reset (next UTC reset, Unix seconds). They are not received-email counters and are not returned by /usage. Responses are not cached. HTTP errors raised by RapidAPI itself may use a different body or headers.

An exhausted received-email allowance rejects new SMTP deliveries; it does not make polling return HTTP 429. Inspect /usage and the test sender's delivery logs. Rejected mail is not queued for later replay by this API.

Limits, pricing and data handling

  • BASIC: free, 50 received emails per UTC day; safety caps of 200 requests and 5 creation attempts per day.
  • PRO: $2.99/month, 1,000 received emails per UTC day; safety caps of 5,000 requests and 100 creation attempts per day. Confirm current pricing on RapidAPI before subscribing.
  • Per inbox: 24-hour API access, 10 received messages, 64 KiB maximum raw email including MIME headers, HTML and encoded attachments. It is not a 64 KiB limit on the text field alone.
  • Shared protection: 2,000 received emails, 50,000 HTTP calls and 500 creation attempts per UTC day across the service. A shared cap may stop service before your individual allowance is used.

Authenticated failed calls and creation attempts can consume request/creation quota. Deleting an inbox does not refund it. Existing inboxes retain the receiving allowance associated with their creation plan; upgrading does not update an already-created inbox. Our counters reset at midnight UTC; RapidAPI can use a subscription-based daily window. Both apply. Platform bandwidth fees and payment requirements are separate; a free subscription does not guarantee card-free checkout.

API access ends after 24 hours, separately from the website's advisory ten-minute timer. Tokens are isolated between the API and browser service. Daily usage records are scheduled for cleanup after 90 days. Mailbox ownership records, including the consumer-identity digest, and message records remain after closure without a fixed erasure schedule. RapidAPI processes forwarded requests and responses, including message data. Use synthetic test data and read the Privacy Policy.

There are no sending, forwarding, webhooks, attachment-download or account-recovery endpoints. For manual receiving without API code, open the browser inbox. For reusable clients and runnable examples, see the Python SDK and TypeScript / Node.js SDK, maintained under controljew.

Need an address for a moment?

Create a temporary inbox →