Temporary emails are a convenient tool for protecting privacy and avoiding spam. Our temporary email service offers simple and easy-to-use APIs that allow you to quickly generate and manage temporary emails, as well as handle email content. This tutorial provides a detailed step-by-step guide to each API, helping you get started efficiently.
Privacy Protection: Use temporary emails to avoid exposing your real email address.
Quick and Easy: Create and receive emails with a single line of code.
Versatile Usage: Ideal for registration, testing email services, or receiving one-time codes.
Here is a detailed guide to using each API.
To ensure secure access to the API, all requests require proper authentication. This can be done using an API key and an authorization token in the request headers. Below is an example of how to include these headers in a request:
Example Request:
curl -X GET https://tempmail-so.p.rapidapi.com/domains \
--header 'x-rapidapi-key:{your-rapidapi-key}' \
--header 'Authorization: Bearer {your-token}'
Headers Explained:
x-rapidapi-key
: Your API key on Rapid, Find it on https://rapidapi.com.
Authorization
: API Token for access tempmail.so service, visit https://tempmail.so/mailboxes and click Account -> Account Infomation to check it out.
Make sure to replace the placeholder values with your actual API key and token when making requests.
Endpoint: GET /domains
Description: Retrieve a list of all available domains supported by the service.
Use Case: When creating an email, you need to select a domain. Free users have access to a limited number of domains, while paid users have access to a larger number of domains.
Sample Request:
curl -X GET https://tempmail-so.p.rapidapi.com/domains
Sample Response:
{
"request-id": "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF",
"message": "Success",
"data": [
{
"domain": "<public domain>"
},
{
"domain": "<alternate public domain>",
"alternate": true
},
{
"domain": "<custom domain>",
"custom": true
}
],
"code": 0
}
Endpoint: POST /inboxes
Description: Create a new temporary email inbox.
Use Case: Generate a personalized temporary email by specifying a domain and an optional email prefix.
Request Parameters:
address
(Required): Custom email prefix.
domain
(Required): Select a domain.
lifespan
(Required): one of 0, 300, 600, 900, 1200, 1800. for seconds of temp mail inbox lifespan, 0 for long-time use inbox.
Sample Request:
curl -X POST https://tempmail-so.p.rapidapi.com/inboxes \
--header 'Content-Type: application/x-www-form-urlencoded' \
-d name=hello123 \
-d domain=mailnuo.com \
-d lifespan=0
Sample Response:
{
"request-id": "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF",
"message": "Success",
"data": {
"id": "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"
},
"code": 0
}
Once successful, you will receive an inbox ID and the full email address for receiving emails.
Endpoint: GET /inboxes
Description: Retrieve all inboxes associated with your account.
Use Case: View all temporary emails you have created.
Sample Request:
curl -X GET https://tempmail-so.p.rapidapi.com/inboxes
Sample Response:
{
"request-id": "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF",
"message": "Success",
"data": [
{
"created": 1700000000,
"lifespan": 600,
"id": "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF",
"name": "<inbox address>",
"permanent": false
},
{
"created": 1700000000,
"lifespan": 0,
"id": "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF",
"name": "<inbox address>",
"permanent": true
}
],
"code": 0
}
Endpoint: DELETE /inboxes/{inbox-id}
Description: Delete a specific inbox by ID.
Use Case: Remove an inbox when it is no longer needed.
Sample Request:
curl -X DELETE https://tempmail-so.p.rapidapi.com/inboxes/{indox-id}
Sample Response:
{
"request-id": "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF",
"message": "Success",
"data": {
"id": "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"
},
"code": 0
}
Endpoint: GET /inboxes/{inbox-id}/mails
Description: Retrieve all emails received by a specific inbox.
Use Case: View all emails received in an inbox.
Sample Request:
curl -X GET https://tempmail-so.p.rapidapi.com/inboxes/{inbox-id}/mails
Sample Response:
{
"request-id": "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF",
"message": "Success",
"data": [
{
"received": 1700000000,
"from": "<sender address>",
"read": false,
"id": "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF",
"subject": "<subject of mail>"
}
],
"code": 0
}
Endpoint: GET /inboxes/{inbox-id}/mails/{mail-id}
Description: Retrieve detailed content of a specific email.
Use Case: View details such as the subject, sender, and body of an email.
Sample Request:
curl -X GET https://tempmail-so.p.rapidapi.com/inboxes/{inbox-id}/mails/{mail-id}
Sample Response:
{
"request-id": "",
"message": "",
"data": {
"textContent": "<text content of mail>",
"forwarded": false,
"htmlContent": "<html content of mail>",
"received": 1700000000,
"from": "<sender address>",
"read": false,
"id": "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF",
"subject": "<mail subject>"
},
"code": 0
}
Endpoint: DELETE /inboxes/{inbox-id}/mails/{mail-id}
Description: Delete a specific email.
Use Case: Remove an email when it is no longer needed.
Sample Request:
curl -X DELETE https://tempmail-so.p.rapidapi.com/inboxes/{inbox-id}/mails/{mail-id}
Sample Response:
{
"request-id": "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF",
"message": "Success",
"data": {
"id": "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"
},
"code": 0
}
With the above APIs, you can easily manage temporary email inboxes and their contents. Whether for protecting your privacy or completing temporary tasks, these APIs are highly practical. We are committed to providing a secure and fast email solution.
If you encounter any issues while using our service, please check out the complete documentation or contact our support team for assistance. Start your temporary email journey today!