Documentation

Everything you need to build with TempMail.

Guides, API references, SDK docs, webhooks, and changelogs — all in one place.

Up and running in 60 seconds.

No account needed. Generate a temporary address instantly and start receiving mail.

1
Open the inbox

Go to tempmail.io — a fresh disposable address is generated automatically. No sign-up, no captcha.

2
Copy your address

Click Copy Address and paste it into any sign-up form or field that asks for an email.

3
Receive mail in real time

Emails arrive via WebSocket. OTP codes and verification links are parsed and highlighted automatically.

4
Address self-destructs

After 60 minutes (or your configured TTL), the address and all messages are permanently deleted.

No registration or personal data required. Everything is anonymous by design.
The technical flow.

When you load TempMail, the frontend calls GET /api/generate_email.php which provisions a random mailbox on our SMTP relay. Your browser opens a WebSocket connection to the message delivery service simultaneously.

When mail is sent to your address it arrives at our relay, is encrypted with AES-256-GCM, and pushed to your open WebSocket — typically within 1–3 seconds.

Message Parsing: Each message is scanned for OTP codes (4–8 digit sequences) and verification links matching /verify, /confirm, or /activate. Detected values surface as one-click UI actions.
Official client libraries.

Install the SDK for your language and start integrating in minutes.

JavaScript

Async/await, TypeScript types included.

npm install tempmail-sdk
Python

Sync + asyncio clients. pytest-ready.

pip install tempmail
PHP

PSR-18 compatible. Laravel examples.

composer require tempmail/sdk
Generate, poll, read.

The three-step pattern behind every TempMail integration.

1. Generate an address
JavaScript
const { email } = await fetch(
  'https://api.tempmail.io/v1/generate_email.php?key=YOUR_KEY'
).then(r => r.json());
console.log(email); // "k9x2m7@tempmail.io"
2. Poll the inbox
JavaScript
const msgs = await fetch(
  `https://api.tempmail.io/v1/inbox.php?key=YOUR_KEY&email=${email}`
).then(r => r.json());
// [{ id, sender, subject, date_received }]
3. Read a message
JavaScript
const msg = await fetch(
  `https://api.tempmail.io/v1/read.php?key=YOUR_KEY&email=${email}&id=${msgs[0].id}`
).then(r => r.json());

if (msg.otp)              console.log('OTP:', msg.otp);
if (msg.confirmation_link) console.log('Link:', msg.confirmation_link);
Automatically extract one-time codes.

The read.php endpoint returns a pre-parsed otp field automatically.

Python
import requests, re

msg = requests.get('https://api.tempmail.io/v1/read.php', params={
    'key': KEY, 'email': email, 'id': msg_id
}).json()

# Pre-parsed field (recommended)
if msg['otp']:
    print(f"OTP: {msg['otp']}")

# Fallback: regex on raw body
match = re.search(r'(\d{4,8})', msg['body'])
if match:
    print(f"Code: {match.group(1)}")
The otp field is null when no code is detected. Always check confirmation_link as a fallback — some services send links instead of numeric codes.
Push instead of poll.

Register a webhook URL and we'll POST the parsed message payload to your server within 500 ms of delivery. Premium only.

cURL — Register webhook
curl -X POST "https://api.tempmail.io/v1/webhook.php"   -d "key=YOUR_KEY"   -d "email=k9x2m7@tempmail.io"   -d "url=https://yourserver.com/hook"
Webhook payload (POST JSON)
{
  "event":             "message.received",
  "id":               "msg_a1b2c3",
  "email":            "k9x2m7@tempmail.io",
  "sender":           "noreply@github.com",
  "subject":          "Verify your email address",
  "otp":              "482910",
  "confirmation_link": null,
  "received_at":      "2026-03-07T13:05:22Z"
}
Use your own domain.

Add an MX record, register via API, then pass domain= when generating addresses. Premium only.

DNS — MX Record
Type:     MX
Host:     @ (or a subdomain: temp)
Value:    mx.tempmail.io
Priority: 10
TTL:      3600
cURL — Register & Generate
# Register domain
curl -X POST "https://api.tempmail.io/v1/domains.php"   -d "key=YOUR_KEY&domain=yourcompany.com"

# Generate address on that domain
curl "https://api.tempmail.io/v1/generate_email.php?key=YOUR_KEY&domain=yourcompany.com"
Use a subdomain like temp.yourcompany.com so your main company MX records are unaffected.
Common questions.
Yes. Attachments up to 10 MB. Images render inline; other types appear as download links. All deleted on address expiry.
Most likely the 60-minute free TTL has elapsed. Some senders add their own internal delays up to 5 minutes — wait and check again. Upgrade to Premium for configurable TTLs up to 30 days.
Some services maintain blocklists of known disposable domains. Using a Premium custom domain bypasses all public blocklists.
No — TempMail is receive-only by design. Outbound SMTP is not and will not be supported.
Free accounts: 10 requests/minute. Premium accounts: 120 requests/minute and 50,000 requests/day. Current limits are returned in every response header as X-RateLimit-Remaining.
Recent updates.
v2.1.0 March 2026
  • Webhook support — real-time push delivery to your server
  • Improved OTP detection for alphanumeric codes
  • New DELETE /delete.php endpoint
  • TLS 1.2 deprecated; TLS 1.3 now required on all connections
v2.0.0 January 2026
  • API v2 with consistent JSON structure and improved error codes
  • Custom domain support for Premium accounts
  • WebSocket delivery replaces long-polling inbox refreshes
  • Official Python and PHP SDKs released
v1.8.0 August 2025
  • Attachment support — images, PDFs, and binary files up to 10 MB
  • Mobile apps for iOS and Android launched
  • Browser extension for Chrome, Firefox, and Edge