
π Documentation & Examples
Everything you need to integrate with mail.tm
π Quick Start Examples
// mail.tm API Example
const response = await fetch('https://docs.mail.tm', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);The Temporary Email Service API offers a straightforward solution for users seeking to maintain privacy and protect their inboxes from spam. With the rise of online registrations and subscriptions, this API allows developers to generate temporary email addresses for one-time use, ensuring that personal email accounts remain secure. By leveraging this service, users can receive verification emails and important notifications without exposing their primary inbox, making it an essential tool for enhancing online privacy and security.
Utilizing the Temporary Email Service API has numerous advantages. Here are five benefits:
- Enhanced Privacy: Safeguard personal email addresses from spam and unwanted communications.
- Ease of Use: Generate temporary email addresses in a few simple steps.
- Automatic Email Retrieval: Access received emails directly through the API without manual checks.
- Short-lived Addresses: Temporary emails automatically expire after use, reducing clutter.
- Integration Ready: Seamlessly incorporate the service into applications and websites with simple API calls.
Hereβs a JavaScript code example to call the Temporary Email Service API:
async function createTemporaryEmail() {
const response = await fetch('https://api.mail.tm/accounts', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
address: 'temp-email@example.com', // Replace with desired email prefix
password: 'securepassword123' // Replace with a secure password
}),
});
if (response.ok) {
const data = await response.json();
console.log('Temporary Email Created:', data);
} else {
console.error('Error creating temporary email:', response.statusText);
}
}
createTemporaryEmail();
Getting Started β No API Key Required
mail.tm has no API-key signup and no paid tier β the API is free and anonymous. Instead of a key, you create a disposable account on the fly and exchange its credentials for a short-lived JSON Web Token (JWT) that authorizes your requests.
Steps:
- Fetch an available domain:
GET https://api.mail.tm/domainsand read the firstdomainfromhydra:member(for example,web-library.net). Domains rotate, so request them live rather than hard-coding one. - Create an account:
POST https://api.mail.tm/accountswith JSON body{"address":"yourname@<domain>","password":"<password>"}. - Get a token:
POST https://api.mail.tm/tokenwith the sameaddressandpassword. The response contains atoken. - Read mail: send that token as a Bearer header on every subsequent call.
curl https://api.mail.tm/messages -H "Authorization: Bearer YOUR_JWT_TOKEN"
The public service is rate limited (you'll get HTTP 429 if you exceed it) and mailboxes are temporary. No credit card, email verification, or developer dashboard is involved. Full reference: https://docs.mail.tm.







