Menu
Affordable temp mail API

Temp Mail API keys for automated email testing

Generate temporary email addresses, receive messages and download attachments through a REST API. Buy your own API key with a fixed request quota for QA and CI/CD workflows. Pay once, with no subscription.

Buy a one-time API key API Documentation Check quota

Affordable temp mail API

Temp Mail API pricing

Purchase a new API key with a fixed number of requests. Each key is independent, never auto-renews, and cannot be topped up.

One-time quota · no subscription

Quota notice: Each authenticated request to a protected API immediately consumes 1 request. Generating an address, checking an inbox (even when it is empty), reading a message, downloading an attachment, deleting or clearing mail, and statistics endpoints all count. Every poll counts separately. Checking this key's remaining quota and purchase-related requests do not consume quota.

Secure payment is handled by Stripe.

Refund policy: API keys are one-time digital products issued immediately after payment. Once a key has been issued, purchases are generally non-refundable, except where required by law or when a verified technical fault prevents delivery.

Your API key

Check API key quota

Enter the full API key. It is sent in the X-API-Key header and never placed in the URL.

Build email checks into your workflow

Sign-up and verification tests

Create a temporary address for tests of your own application. Read verification messages and extract links or codes from your test inbox.

CI/CD and regression testing

Use HTTP requests and JSON responses in your test scripts to check email delivery during releases and regression tests.

Email and attachment checks

Inspect message content and download attachments to test the transactional emails sent by your application.

API key pricing and purchase questions

Can I try the API before buying?

ct-test is a shared, limited key for trying examples. Its usage and remaining quota are shared by everyone and can be checked with the quota endpoint. Use a purchased key for production workloads.

Quickstart
Is this a subscription?

Purchase a new API key with a fixed number of requests. Each key is independent, never auto-renews, and cannot be topped up.

Which requests use my quota?

A protected request consumes 1 request immediately after its API key is authenticated. Empty inbox results, repeated polling, and handler errors such as an invalid parameter or missing email still count. Public domain listing, quota lookup, and billing endpoints do not consume quota.

How do I get my API key after payment?

After Stripe confirms payment, the purchase page displays your new API key. Save it securely. You can recover the key through your private link for 90 days.

Can I get a refund?

Refund policy: API keys are one-time digital products issued immediately after payment. Once a key has been issued, purchases are generally non-refundable, except where required by law or when a verified technical fault prevents delivery.

Buy a one-time API key

API Documentation

API Documentation

Complete reference for generating addresses, receiving messages, downloading attachments, managing inboxes, reading statistics, and checking quota. Every example below can be copied directly and adapted with your own API key and returned IDs.

Test key ct-test
Base URL https://cleantempmail.com/api

01 · Quickstart

Quickstart

There is no mailbox-registration step. Fetch the active domains for free, compose a valid address locally or use the optional generator, then query that address and process the returned messages. Request and response examples are documented once in the endpoint reference below.

1

Get active domains

Call /api/domains without a key. This public helper does not consume quota.

2

Compose or generate

Build any valid prefix@active-domain locally for free, or spend 1 request on the optional generator.

3

Check the inbox

Pass the full address to /api/emails. An empty list is a successful response, not an error.

4

Read or download

Use emails[].id to fetch a message and attachments[].id to download a file.

Use public subdomains

Read the public domain catalog first. The subdomains array describes each base domain: domain is the base name, wildcard indicates wildcard MX support, and children lists explicitly configured subdomains.

curl 'https://cleantempmail.com/api/domains?offset=0&limit=1000'
{"subdomains":[
  {"domain":"example.com","wildcard":true,"children":["mail.example.com"]},
  {"domain":"example.org","wildcard":false,"children":["inbox.example.org"]}
]}

When wildcard is true, you can choose a single subdomain label, such as mail.example.com. When wildcard is false, use only a name listed in children. The chosen name must have valid MX records; an existing DNS name can override wildcard records and be unavailable.

POST /api/generate-email accepts the full subdomain in domain. prefix is the mailbox name before @, not the subdomain label. Replace example.com below with a supported public domain from the catalog.

curl -X POST 'https://cleantempmail.com/api/generate-email' \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  --data '{"prefix":"demo","domain":"mail.example.com"}'

curl 'https://cleantempmail.com/api/[email protected]' \
  -H 'X-API-Key: YOUR_API_KEY'

Use the full email address to read or delete messages. Omitting domain selects a random base domain; it does not create a random subdomain. A subdomain shown as an independent domain remains usable by its full name.

Only public domains are available through API keys. Private domains and GPTMail members-only domains, including their subdomains, are excluded.

02 · Authentication & quota

Authentication

Send your key in the X-API-Key request header. Keep paid keys on your server; do not expose them in browser code, public repositories, query strings, or logs.

X-API-Key: YOUR_API_KEY
Shared test key

ct-test is a shared, limited key for trying examples. Its usage and remaining quota are shared by everyone and can be checked with the quota endpoint. Use a purchased key for production workloads.

When quota is consumed

A protected request consumes 1 request immediately after its API key is authenticated. Empty inbox results, repeated polling, and handler errors such as an invalid parameter or missing email still count. Public domain listing, quota lookup, and billing endpoints do not consume quota.

JSON response envelope

JSON endpoints return success plus either data or error. Authenticated protected endpoints also include the updated usage object. Attachment downloads return binary data instead of this JSON envelope.

{
  "success": true,
  "data": { "...": "endpoint-specific data" },
  "usage": {
    "daily_limit": 100,
    "used_today": 7,
    "remaining_today": 93,
    "total_limit": 1000,
    "total_used": 42,
    "remaining_total": 958
  }
}

For quota fields, a limit of 0 and a remaining value of -1 mean unlimited. A purchased one-time key normally has a positive total_limit.

03 · All endpoints

Core endpoints

Endpoints are grouped by the operation they perform. The badge on each endpoint shows whether a successful authentication attempt consumes quota.

GET /api/domains No API key · no quota

List active public domains

Returns domains currently available for address generation. This public helper does not require an API key and does not consume quota. Private GPTMail domains are excluded.

ParameterRequiredDescription
qOptionalCase-insensitive substring filter for domain names.
offsetOptionalNumber of matching domains to skip. Defaults to 0.
limitOptionalNumber of domains to return. Defaults to 1000 and is capped at 2000.
curl -sS "https://cleantempmail.com/api/domains?limit=100"
{
  "success": true,
  "data": {
    "domains": ["domain-one.example", "domain-two.example"],
    "total": 1832,
    "offset": 0,
    "limit": 100
  }
}
GET POST /api/generate-email API key · 1 request

Generate a temporary email address

GET creates an address with a generated prefix and a random active domain. POST optionally selects a prefix, a domain, or both. The response always returns the final address in data.email.

Generation is optional — save quota by composing locally

You do not need to call this endpoint before receiving mail. After obtaining an active domain from /api/domains, combine it locally with any valid prefix, such as [email protected]. Mail sent to that address can be queried normally, and composing it locally consumes no quota. Use /api/generate-email only when you want the service to choose or validate the address for you; each call consumes 1 request.

JSON fieldRequiredDescription
prefixOptionalMailbox name before @. Letters, digits, dots, underscores, and hyphens are accepted within the service-configured length.
domainOptionalAn exact active domain returned by /api/domains. If omitted, the service chooses one randomly.
Generate a random address
curl -sS \
  -H "X-API-Key: ct-test" \
  "https://cleantempmail.com/api/generate-email"
Generate an address with a custom prefix and domain
curl -sS -X POST \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"prefix":"qa.user","domain":"your-active-domain.com"}' \
  "https://cleantempmail.com/api/generate-email"

If the requested domain is no longer active, the API returns HTTP 409 instead of silently switching to another domain.

GET /api/emails?email={address} API key · 1 request

List messages in an inbox

Returns up to the latest 500 messages for one public CleanTempMail address. A new or empty inbox returns emails: [] and count: 0.

ParameterRequiredDescription
emailYesComplete mailbox address, including its domain. URL-encode this value.
curl -sS -G \
  -H "X-API-Key: YOUR_API_KEY" \
  --data-urlencode "[email protected]" \
  "https://cleantempmail.com/api/emails"
{
  "success": true,
  "data": {
    "emails": [
      {
        "id": "66c123example",
        "email_address": "[email protected]",
        "from_address": "[email protected]",
        "subject": "Your verification code",
        "content": "Your code is 123456",
        "html_content": "<p>Your code is <b>123456</b></p>",
        "has_html": true,
        "attachments": [
          {
            "id": "attachment-id",
            "filename": "receipt.pdf",
            "content_type": "application/pdf",
            "size": 48231
          }
        ],
        "timestamp": 1787702400,
        "raw_size": 51984,
        "created_at": "2026-08-25T12:00:00Z"
      }
    ],
    "count": 1
  },
  "usage": { "daily_limit": 100, "used_today": 2, "remaining_today": 98, "total_limit": 1000, "total_used": 2, "remaining_total": 998 }
}

Every poll consumes 1 request, even when no email has arrived. Start around one request every 10 seconds and back off when possible; do not run tight polling loops.

GET /api/email/{id} API key · 1 request

Fetch one complete message

Uses the id returned by /api/emails to retrieve one message, including text/HTML content, headers, timestamps, and attachment metadata. Attachment bytes are not embedded in JSON.

curl -sS \
  -H "X-API-Key: YOUR_API_KEY" \
  "https://cleantempmail.com/api/email/66c123example"
Important email fields
JSON fieldDescription
idMessage ID used by read, attachment, and delete endpoints.
email_addressInbox address that received the message.
from_addressParsed sender address.
subjectParsed message subject.
content / html_contentPlain-text and sanitized/renderable HTML representations. Check has_html before preferring HTML.
attachments[]Attachment metadata: id, filename, content_type, size, and optional content_id. Binary data is downloaded separately.
timestamp / created_atUnix timestamp and ISO 8601 creation time.
raw_content / headers / raw_sizeRaw message/header data when stored, plus the original message size in bytes.
GET /api/email/{id}/attachment/{attachmentID} API key · 1 request

Download an attachment

Download one attachment as a binary file. Use the email id and an attachments[].id value returned by GET /api/email/{id}. Each download consumes 1 API request.

curl -fL -OJ \
  -H "X-API-Key: YOUR_API_KEY" \
  "https://cleantempmail.com/api/email/66c123example/attachment/attachment-id"

The response body is the file itself. Content-Type, Content-Length, and Content-Disposition are set by the server. curl -OJ saves the safe server-provided filename. Attachment errors are returned as plain text.

DELETE /api/email/{id} API key · 1 request

Delete one message

Permanently deletes the message identified by id. Fetch the ID from /api/emails first. This action cannot be undone.

curl -sS -X DELETE \
  -H "X-API-Key: YOUR_API_KEY" \
  "https://cleantempmail.com/api/email/66c123example"
{"success":true,"data":{"message":"Email deleted"},"usage":{"daily_limit":100,"used_today":4,"remaining_today":96,"total_limit":1000,"total_used":4,"remaining_total":996}}
DELETE /api/emails/clear?email={address} API key · 1 request

Clear an inbox

Permanently deletes every stored message for the supplied public mailbox and returns the number deleted. This action cannot be undone.

curl -sS -X DELETE -G \
  -H "X-API-Key: YOUR_API_KEY" \
  --data-urlencode "[email protected]" \
  "https://cleantempmail.com/api/emails/clear"
{"success":true,"data":{"message":"Deleted 3 emails","count":3},"usage":{"daily_limit":100,"used_today":5,"remaining_today":95,"total_limit":1000,"total_used":5,"remaining_total":995}}
GET /api/stats · /api/statistics/* API key · 1 per endpoint

Stats endpoints

Returns cached public service statistics. Each path is a separate protected request and consumes 1 request. Private-domain mail is excluded from public statistics.

PathDescription
/api/statsOverall totals: total emails, today, last 24 hours, unique subjects, and active domains.
/api/statistics/24hArray of hourly UTC buckets with hour and count.
/api/statistics/top-subjectsTop 10 public message subjects with count.
/api/statistics/top-domainsTop 10 public recipient domains with count.
/api/statistics/top-sendersTop 10 senders with count.
curl -sS \
  -H "X-API-Key: YOUR_API_KEY" \
  "https://cleantempmail.com/api/stats"
{
  "success": true,
  "data": {
    "total_emails": 1250000,
    "today_emails": 32000,
    "emails_24h": 41000,
    "unique_subjects": 8600,
    "active_domains": 1832
  },
  "usage": { "daily_limit": 100, "used_today": 6, "remaining_today": 94, "total_limit": 1000, "total_used": 6, "remaining_total": 994 }
}
POST /api/api-key/usage No API key · no quota

Check API key quota

Returns status and usage for a purchased, manually created, exhausted, or shared test key. This lookup does not consume quota. Supply the key either in X-API-Key or in a JSON api_key field; the header is recommended.

Recommended: send the key in a header
curl -sS -X POST \
  -H "X-API-Key: YOUR_API_KEY" \
  "https://cleantempmail.com/api/api-key/usage"
Also supported: send the key in JSON
curl -sS -X POST \
  -H "Content-Type: application/json" \
  --data '{"api_key":"ct-test"}' \
  "https://cleantempmail.com/api/api-key/usage"
{
  "success": true,
  "data": {
    "masked_key": "••••••••wxyz",
    "status": "active",
    "is_active": true,
    "daily_limit": 100,
    "used_today": 6,
    "remaining_today": 94,
    "total_limit": 1000,
    "total_used": 6,
    "remaining_total": 994
  }
}

status is active, exhausted, or inactive. Exhausted purchased keys remain queryable. The full key and Stripe/customer metadata are never returned.

04 · Errors

HTTP errors and recovery

JSON endpoints normally return success: false and an error string. The attachment endpoint returns plain text on failure. Always branch on the HTTP status before reading data.

HTTPMeaningRecommended action
400Missing or invalid input, such as an absent email parameter or invalid prefix.Fix the request; do not retry unchanged.
401API key is missing, invalid, or no longer active.Check X-API-Key or purchase/use another active key.
403The requested inbox belongs to a private GPTMail domain.Do not access private GPTMail inboxes through this API.
404Message or attachment ID was not found or has expired.Refresh the inbox list and stop retrying stale IDs.
409The explicitly selected generation domain is unavailable.Fetch /api/domains and deliberately choose an active domain.
429Daily or total quota has been exhausted.Wait for the daily reset or use a newly purchased key; one-time keys cannot be recharged.
503Inbox routing is synchronizing or no active domain is available.Respect Retry-After when present and retry with backoff.
{
  "success": false,
  "error": "Email not found",
  "usage": {
    "daily_limit": 100,
    "used_today": 7,
    "remaining_today": 93,
    "total_limit": 1000,
    "total_used": 7,
    "remaining_total": 993
  }
}