Guides, code examples, SDK references, and answers to common questions — all in one place.
Navigate to tempmail.io — an address is generated automatically on page load. No account required.
Click Copy Address and paste it into any sign-up form or website that requires an email.
Emails appear in real time via WebSocket. OTP codes and verification links are parsed and highlighted automatically.
After 60 minutes (or your configured TTL), the address and all messages are permanently deleted.
When you load TempMail, the frontend calls GET /api/generate_email.php which provisions a random mailbox on our SMTP relay server. Your browser receives the address and simultaneously opens a WebSocket connection to our message delivery service.
When an email is sent to your temporary address, it traverses standard internet SMTP routing, arrives at our relay server, is encrypted with AES-256-GCM, and pushed to your open WebSocket connection — typically within 1–3 seconds of the sender pressing send.
Each incoming message is scanned by our parser for two patterns:
/verify, /confirm, /activateDetected values are surfaced in the UI as actionable components so you can copy or click without reading the raw email body.
const res = await fetch( 'https://api.tempmail.io/v1/generate_email.php?key=YOUR_KEY' ); const { email } = await res.json(); console.log('Your address:', email);
async function pollInbox(email) { const res = await fetch( `https://api.tempmail.io/v1/inbox.php?key=YOUR_KEY&email=${email}` ); const messages = await res.json(); return messages; } // Poll every 5 seconds setInterval(() => pollInbox(email), 5000);
const msg = await fetch( `https://api.tempmail.io/v1/read.php?key=YOUR_KEY&email=${email}&id=${msgId}` ).then(r => r.json()); if (msg.otp) { console.log('OTP Code:', msg.otp); } else if (msg.confirmation_link) { console.log('Verify URL:', msg.confirmation_link); }
The read.php endpoint returns a pre-parsed otp field when a code is detected. You can also run your own regex against the message body if you need a different matching strategy.
import requests, re msg = requests.get( 'https://api.tempmail.io/v1/read.php', params={'key': 'YOUR_KEY', 'email': email, 'id': msg_id} ).json() # Use the pre-parsed field if msg['otp']: print(f"OTP: {msg['otp']}") # Or run your own regex match = re.search(r'\b(\d{4,8})\b', msg['body']) if match: print(f"Found code: {match.group(1)}")
otp field is null if no code is detected. Always check confirmation_link as a fallback — some services send links instead of codes.Premium accounts can register a webhook URL. When a message arrives at a disposable address, TempMail will POST the parsed message payload to your endpoint within 500ms.
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"
{
"event": "message.received",
"id": "msg_a1b2c3",
"email": "k9x2m7@tempmail.io",
"sender": "noreply@example.com",
"subject": "Your verification code",
"otp": "482910",
"confirmation_link": null,
"received_at": "2026-03-07T13:05:22Z"
}
With a Premium account you can configure your own domain (e.g. @yourcompany.com) so disposable addresses look like temp-x7f2k@yourcompany.com.
Add the following MX record to your domain's DNS settings:
Type: MX Host: @ Value: mx.tempmail.io Priority: 10 TTL: 3600
Once propagated (typically 5–30 minutes), register your domain via the API:
curl -X POST "https://api.tempmail.io/v1/domains.php" \ -d "key=YOUR_KEY" \ -d "domain=yourcompany.com"
temp.yourcompany.com) to avoid disrupting existing email.ttl parameter in the API, or by selecting the duration in the dashboard before generating.DELETE /delete.php endpoint for early address destruction