ETMail API Documentation
Version 1.0
Welcome to the official ETMail API documentation. The ETMail API enables developers to integrate temporary email functionality into their applications, websites, and automated systems.
You can create temporary email addresses, retrieve your inboxes, check incoming messages, access complete message content, and revoke access to inboxes using simple HTTP requests.
The API uses JSON responses and Bearer Token authentication.
1. Getting Started
Base URL
All API requests must be sent to:
https://etmail.shop/api/v1
Protocol: HTTPS is required.
Response Format: JSON
Authentication: Bearer Token
2. Authentication
Every API request must include a valid API key in the Authorization header.
Required Header:
Authorization: Bearer YOUR_API_KEYExample:
Authorization: Bearer etm_live_YOUR_SECRET_KEYYour API key is a private credential that identifies your account and authorizes access to your resources.
Never share your API key publicly or expose it in frontend JavaScript, public repositories, or client-side applications.
If your key is compromised, revoke it and generate a replacement.
3. API Status
Check whether the API service is operational.
Method: GET
Endpoint: /
Full URL: https://etmail.shop/api/v1/
Example Request:
curl -X GET "https://etmail.shop/api/v1/" \-H "Authorization: Bearer YOUR_API_KEY"
Successful Response: HTTP 200
{ "success": true,
"data": {
"service": "etmail API",
"version": "v1",
"status": "operational"
}
}
4. Create an Inbox
Create a new temporary email address associated with your API key.
Method: POST
Endpoint: /inboxes
Full URL: https://etmail.shop/api/v1/inboxes
Headers:
Authorization: Bearer YOUR_API_KEYContent-Type: application/json
Request Body:
{ "lifetime": "1h"
}
The lifetime parameter is optional. If omitted, the default lifetime configured for your API key will be applied.
Successful Response: HTTP 201
{ "success": true,
"data": {
"id": 123,
"email": "example@etmail.shop",
"lifetime": "1h",
"created_at": "2026-11-12 10:00:00",
"expires_at": "2026-11-12 11:00:00"
}
}
Response Parameters:
id — Unique inbox identifier. Required for retrieving messages and managing the inbox.
email — The generated temporary email address.
lifetime — The selected email lifetime.
created_at — Inbox creation date and time.
expires_at — Inbox expiration date and time.
5. List Inboxes
Retrieve all active inboxes associated with your API key.
Method: GET
Endpoint: /inboxes
Full URL: https://etmail.shop/api/v1/inboxes
Query Parameters:
page — Page number. Default: 1.
per_page — Number of results per page. Default: 20. Maximum: 100.
Example Request:
curl -X GET "https://etmail.shop/api/v1/inboxes?page=1&per_page=20" \-H "Authorization: Bearer YOUR_API_KEY"
Successful Response: HTTP 200
{ "success": true,
"data": [
{
"id": 123,
"email": "example@etmail.shop",
"lifetime": "1h",
"created_at": "2026-11-12 10:00:00",
"expires_at": "2026-11-12 11:00:00"
}
],
"pagination": {
"page": 1,
"per_page": 20,
"total": 1,
"total_pages": 1
}
}
Only active, non-expired inboxes that belong to your API key are returned.
6. Retrieve Inbox Messages
Retrieve the messages received by a specific inbox.
Method: GET
Endpoint: /messages
Full URL: https://etmail.shop/api/v1/messages
Query Parameters:
inbox_id — Required. The unique ID of the inbox.
page — Page number. Default: 1.
per_page — Number of messages per page. Default: 20. Maximum: 100.
Example Request:
curl -X GET "https://etmail.shop/api/v1/messages?inbox_id=123&page=1&per_page=20" \-H "Authorization: Bearer YOUR_API_KEY"
Successful Response: HTTP 200
{ "success": true,
"data": [
{
"id": 456,
"subject": "Your verification code",
"from_email": "noreply@example.com",
"to_email": "example@etmail.shop",
"received_at": "2026-11-12 10:15:00"
}
],
"pagination": {
"page": 1,
"per_page": 20,
"total": 1,
"total_pages": 1
}
}
Message Parameters:
id — Unique message identifier.
subject — Email subject.
from_email — Sender email address.
to_email — Recipient email address.
received_at — Message received date and time.
Messages are returned in descending order, with the newest messages first.
The API checks inbox ownership and availability before retrieving messages. It may also check the mailbox for newly received emails.
7. Retrieve Message Details
Retrieve the complete details and content of a specific email message.
Method: GET
Endpoint: /messages/{message_id}
Example URL:
https://etmail.shop/api/v1/messages/456
Example Request:
curl -X GET "https://etmail.shop/api/v1/messages/456" \-H "Authorization: Bearer YOUR_API_KEY"
Successful Response: HTTP 200
{ "success": true,
"data": {
"id": 456,
"subject": "Your verification code",
"from_email": "noreply@example.com",
"to_email": "example@etmail.shop",
"received_at": "2026-11-12 10:15:00",
"text_body": "Your email message content...",
"html_body": "<html><body>Your email message content...</body></html>"
}
}
Additional Parameters:
text_body — Plain-text version of the email content.
html_body — Original HTML version of the email content, when available.
Important: Always sanitize HTML email content before displaying it in a browser. Do not insert untrusted email HTML directly into your page.
Message access is restricted to active inboxes associated with your API key.
8. Delete an Inbox
Revoke your API key's access to a specific inbox.
Method: DELETE
Endpoint: /inboxes/{inbox_id}
Example URL:
https://etmail.shop/api/v1/inboxes/123
Example Request:
curl -X DELETE "https://etmail.shop/api/v1/inboxes/123" \-H "Authorization: Bearer YOUR_API_KEY"
Successful Response: HTTP 200
{ "success": true,
"data": {
"id": 123,
"revoked": true
}
}
Important: This operation revokes the association between your API key and the inbox. It does not immediately delete the underlying mailbox or its stored messages.
Once access has been revoked, the inbox can no longer be accessed through that API key.
9. Supported Email Lifetimes
The API supports the following email address lifetimes:
10m — 10 minutes.
1h — 1 hour.
1d — 1 day.
1w — 1 week.
1mo — 1 calendar month.
forever — No practical expiration within the supported date range.
The available lifetimes depend on the permissions configured for your API key.
If you request a lifetime that is not enabled for your key, the API returns HTTP 403.
10. API Usage Limits
Each API key may have individual usage limits configured by the administrator.
Supported limits include:
Daily Request Limit — Maximum number of API requests allowed per day.
Monthly Request Limit — Maximum number of API requests allowed per month.
Daily Email Creation Limit — Maximum number of inboxes that can be created per day.
Monthly Email Creation Limit — Maximum number of inboxes that can be created per month.
When a configured limit is reached, the API returns HTTP 429.
Usage periods are calculated using UTC.
11. Error Handling
All API errors are returned in a consistent JSON structure.
Example Error Response:
{ "success": false,
"error": {
"code": "invalid_api_key",
"message": "A valid API key is required"
}
}
HTTP Status Codes:
200 OK — The request was successful.
201 Created — A new inbox was successfully created.
400 Bad Request — The request contains invalid JSON.
401 Unauthorized — The API key is missing, invalid, disabled, or expired.
403 Forbidden — The requested operation or email lifetime is not permitted.
404 Not Found — The requested inbox, message, or endpoint could not be found.
405 Method Not Allowed — The HTTP method is not supported.
413 Payload Too Large — The request body exceeds the allowed size.
422 Unprocessable Entity — The request contains an invalid parameter or unsupported value.
429 Too Many Requests — An API usage limit has been reached.
503 Service Unavailable — The service is temporarily unavailable or cannot process the request.
12. Complete Integration Example
The following PHP example demonstrates how to create an inbox and retrieve its messages.
<?php$apiKey = 'YOUR_API_KEY';$baseUrl = 'https://etmail.shop/api/v1';
// Create a new inbox
$ch = curl_init($baseUrl . '/inboxes');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => json_encode([
'lifetime' => '1h'
])
]);
$response = curl_exec($ch);
curl_close($ch);
$result = json_decode($response, true);
if (!isset($result['success']) || !$result['success']) {
die('Failed to create inbox');
}
$inboxId = $result['data']['id'];
$email = $result['data']['email'];
echo "Created email: " . $email;
// Retrieve inbox messages
$url = $baseUrl . '/messages?inbox_id=' . $inboxId;
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey
]
]);
$response = curl_exec($ch);
curl_close($ch);
$messages = json_decode($response, true);
if (isset($messages['success']) && $messages['success']) {
foreach ($messages['data'] as $message) {
echo "\nSubject: " . $message['subject'];
echo "\nSender: " . $message['from_email'];
echo "\nMessage ID: " . $message['id'];
}
}
?>
13. Best Practices
Keep your API key private and store it securely on your server.
Always use HTTPS when communicating with the API.
Save the inbox ID returned when creating a new email address.
Use pagination when retrieving inboxes and messages.
Check the expiration time before attempting to access an inbox.
Handle API errors and HTTP status codes properly.
Sanitize HTML email content before displaying it.
Respect the usage limits configured for your API key.
Avoid unnecessary requests and use appropriate error handling in your application.
14. Support
For technical assistance, integration questions, or API-related support, please contact the ETMail support team.
Thank you for using ETMail.
ETMail — Temporary Email API.