Temp Mail API: Programmatic Inboxes for QA and Automation
Read disposable inboxes from code. TEMPMAIL.TW offers REST endpoints, a real-time SSE stream and custom domains, so your tests can receive sign-up and password-reset mail without a shared mailbox.
- Instant delivery
- Private, no tracking
- No signup
Your address
Kept 3 minutesType a mailbox name or hit Random.
Paste this address wherever you need to receive mail.
You can paste a full address too.
Inbox
No inbox selected
Enter an email address then click Get Mail
Select a mail
Pick a mail in the inbox to read its content here
Realtime connected
What the API does
When your application sends a sign-up, password-reset or notification email, an automated test needs to receive it. A shared mailbox is slow and flaky, and a mocked mail layer never exercises the real path. A temporary inbox you can read over HTTP gives you the real message in seconds.
There is no separate create-inbox call. On the shared system domains, any address becomes an inbox as soon as mail is sent to it, so your test only has to invent a unique address. The endpoints cover the rest: list the available domains, list the messages for an address, check cheaply whether anything new arrived, open a live SSE stream, read a single message and delete it.
Send your API key in the X-API-Key header. Depending on how the operator has configured the site, anonymous script access to inboxes may be closed, so plan on sending a key. The full reference is at /docs/api.
A typical test flow
The pattern is the same whichever framework you use:
- Pick a domain from /api/domains and build an address that is unique to this test run, such as the run ID plus a random suffix.
- Trigger the email in your application, for example by submitting the sign-up form with that address.
- Open the SSE stream for the address, or poll the lightweight head endpoint, and wait for a new message instead of sleeping for a fixed time.
- Read the message and take the code or link from its text body.
- Assert on the result and, optionally, delete the message. Anything left behind is deleted automatically when its retention window ends.
Extracting OTP codes and links
Messages come back with their text and HTML bodies. The API does not return a ready-made code field, so extract it in your test: a regular expression for a 4 to 8 digit number near words such as code or verify covers most senders, and a link can be matched by its host or path. The web inbox applies a similar heuristic when it highlights a code.
Check the sender and subject before matching, and use a fresh address for each run, so you can never pick up a code from an earlier test.
Custom domains, read keys and plans
Shared domains are enough for most functional tests, but some staging environments block disposable domains, or you may want a stable domain that belongs to you. Point an MX record at the service to receive mail on your own domain; the setup guides for Cloudflare, Namecheap, GoDaddy and Porkbun are on /custom-domain. Any signed-in account can add a domain, which is shared with the public pool on the free plan. Paid plans keep it private, and Business also catches subdomains, which is handy for one subdomain per test environment.
Read keys are read-only credentials for reseller-style use. A key can only read mail, never change anything, and whoever issues it can limit it to messages from certain senders. Daily quotas, retention and which domains each plan can read are listed on /pricing.
Limits to plan around
The service is receive-only, so your application sends mail to it and the API cannot send. Messages are deleted automatically 3 minutes after arrival on the free plan and 20 minutes on Pro and Business, so read them promptly. Shared-domain inboxes are public, so never put real secrets in test mail; use your own private domain when that matters. Requests that exceed your quota receive HTTP 429 with a Retry-After header.
How it works
- 1
Authenticate
Send your API key in the X-API-Key header. Keys, quotas and the domains each plan can read are described at /docs/api and /pricing.
- 2
Send mail to a unique address
Choose a domain, build an address for this run and trigger the email from your application.
- 3
Wait and assert
Wait on the SSE stream or the head endpoint, read the message, extract the code or link and check it.
Frequently asked
Does TEMPMAIL.TW have a temp mail API?
Yes. It exposes REST endpoints for domains, inboxes and messages, plus a real-time SSE stream. The reference is at /docs/api, and plan limits are on /pricing.
Can I wait for an email without polling?
Yes. Open the SSE stream for the address and you receive an event the moment mail lands. If you prefer polling, the head endpoint is a cheap way to check for new mail.
How do I get a verification code through the API?
Read the message and parse its text body. A regular expression for a 4 to 8 digit number near words such as code or verify works for most senders. There is no separate OTP field to call.
Can I use my own domain with the API?
Yes. Add the domain with an MX record, then read its inboxes the same way as the shared ones. Private domains need a paid plan, and Business adds subdomain mail.
Can I send email through the API?
No. The service only receives mail. Your application sends to it, and your tests read it.
Are there rate limits?
Yes. Each plan has a daily quota for API-key requests, and requests over the limit return HTTP 429 with a Retry-After header. The numbers are on /pricing.
Related pages
- Temp Mail for OTPReceive OTP and verification codes on a free temporary email. Codes are detected automatically with one-click copy, and mail arrives in seconds.
- Fake Email GeneratorGenerate a fake email address that really receives mail. Random or custom names on 1,000+ domains — free, no sign-up, one-click copy.
- Disposable EmailCreate a disposable email address in one click. Free, no registration, real-time delivery and automatic deletion keep your real inbox spam-free.