## Authentication
Learn how to obtain and use API keys
## Get API Key
Before using the API, you need to obtain an API key. You can create your API key on the Profile page.
### Using API Key
Include your API key in the request headers for all API requests:
[Code (bash)]
X-API-Key: YOUR_API_KEY
[/Code]
### Important Notes
- Keep your API key secure and do not expose it in public places
- The API key has the same permissions as your account, use it carefully
- If your API key is compromised, immediately regenerate a new one in your Profile page
---
## Email API
Create and manage emails
## Get Available Domains
Get all available email domains in the system.
### Request
[Code (bash)]
GET /api/email/domains
[/Code]
### Request Example
[Code (bash)]
curl https://chat-tempmail.com/api/email/domains \
-H "X-API-Key: YOUR_API_KEY"
[/Code]
### Response Parameters
Parameter | Type | Description
----------- | ------ | -------------
domains | array | List of available email domains
### Response Example
[Code (json)]
{
"domains": [
"chat-tempmail.com",
"example.com",
"other-domain.com"
]
}
[/Code]
## Create Email
Create a new temporary email address.
### Request
[Code (bash)]
POST /api/emails/generate
[/Code]
### Request Parameters
Parameter | Type | Required | Description
----------- | ------ | ---------- | -------------
name | string | Yes | Email prefix
expiryTime | number | Yes | Expiry time (milliseconds)
Available values:
- 3600000 (1 hour)
- 86400000 (1 day)
- 259200000 (3 days)
- 0 (permanent)
domain | string | Yes | Email domain
### Request Example
[Code (bash)]
curl -X POST https://chat-tempmail.com/api/emails/generate \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "test",
"expiryTime": 3600000,
"domain": "chat-tempmail.com"
}'
[/Code]
### Response Parameters
Parameter | Type | Description
----------- | ------ | -------------
id | string | Unique identifier of the email (UUID format)
email | string | Created email address (full email address)
### Response Example
[Code (json)]
{
"id": "c2c4f894-c672-4d5b-a918-abca95aff1f7",
"email": "test@chat-tempmail.com"
}
[/Code]
## Get Email List
Get all email addresses under your account.
### Request
[Code (bash)]
GET /api/emails
[/Code]
### Request Parameters
Parameter | Type | Required | Description
----------- | ------ | ---------- | -------------
cursor | string | No | Pagination cursor, get nextCursor from previous response
### Request Example
[Code (bash)]
curl https://chat-tempmail.com/api/emails \
-H "X-API-Key: YOUR_API_KEY"
[/Code]
### Response Parameters
Parameter | Type | Description
----------- | ------ | -------------
emails | array | Email list (max 20 items per request)
nextCursor | string | Next page cursor for getting more data
total | number | Total number of emails
### Email Objects in emails Array
Parameter | Type | Description
----------- | ------ | -------------
id | string | Unique identifier of the email (UUID format)
address | string | Email address (full email address)
userId | string | User ID who owns the email (UUID format)
createdAt | string | Email creation time (ISO 8601 format)
expiresAt | string | Email expiry time (ISO 8601 format)
### Response Example
[Code (json)]
{
"emails": [
{
"id": "e4ff5c14-8a72-48c5-bd13-b5347fb944da",
"address": "6Tg3VT@chat-tempmail.com",
"userId": "bd08008d-e944-44b2-a0d0-67f2b528ee6d",
"createdAt": "2025-04-21T08:30:45.084Z",
"expiresAt": "2025-04-22T08:30:45.084Z"
}
],
"nextCursor": "fd13a8df-1465-4fbc-a612-ca7311c31ff2",
"total": 20
}
[/Code]
## Delete Email
Delete the specified email address.
### Request
[Code (bash)]
DELETE /api/emails/{emailId}
[/Code]
### Request Parameters
Parameter | Type | Required | Description
----------- | ------ | ---------- | -------------
emailId | string | Yes | Email ID (path parameter)
### Request Example
[Code (bash)]
curl -X DELETE "https://chat-tempmail.com/api/emails/99fadf12-6826-490a-9c6c-b0b528d4a8e0" \
-H "X-API-Key: YOUR_API_KEY"
[/Code]
### Response Parameters
Parameter | Type | Description
----------- | ------ | -------------
success | boolean | Whether deletion was successful
### Response Example
[Code (json)]
{
"success": true
}
[/Code]
---
## Message API
Manage messages
## Get Message List
Get all messages in the specified email address.
### Request
[Code (bash)]
GET /api/emails/{emailId}
[/Code]
### Request Parameters
Parameter | Type | Required | Description
----------- | ------ | ---------- | -------------
emailId | string | Yes | Email ID (path parameter)
cursor | string | No | Pagination cursor (query parameter), get nextCursor from previous response
### Request Example
[Code (bash)]
curl "https://chat-tempmail.com/api/emails/c2c4f894-c672-4d5b-a918-abca95aff1f7" \
-H "X-API-Key: YOUR_API_KEY"
[/Code]
### Response Parameters
Parameter | Type | Description
----------- | ------ | -------------
messages | array | Message list (max 20 items per request)
nextCursor | string | Next page cursor for getting more data
total | number | Total number of messages
### Message Objects in messages Array
Parameter | Type | Description
----------- | ------ | -------------
id | string | Unique identifier of the message (UUID format)
from_address | string | Sender address
subject | string | Message subject
received_at | number | Received time (Unix timestamp in milliseconds)
### Response Example
[Code (json)]
{
"messages": [
{
"id": "fd13a8df-1465-4fbc-a612-ca7311c31ff2",
"from_address": "sender1@example.com",
"subject": "Test Message 1 - xJOK2h",
"received_at": 1745224245084
}
],
"nextCursor": "eyJ0aW1lc3RhbXAiOjE3NDUxNTU4NDUwODQsImlkIjoiNjNmNzFlODYtOGE1NC00ZDQ0LTk5ZWYtN2QzNTBhMTQ4M2JiIn0=",
"total": 50
}
[/Code]
## Get Message Details
Get detailed content of the specified message.
### Request
[Code (bash)]
GET /api/emails/{emailId}/{messageId}
[/Code]
### Request Parameters
Parameter | Type | Required | Description
----------- | ------ | ---------- | -------------
emailId | string | Yes | Email ID (path parameter)
messageId | string | Yes | Message ID (path parameter)
### Request Example
[Code (bash)]
curl "https://chat-tempmail.com/api/emails/99fadf12-6826-490a-9c6c-b0b528d4a8e0/fd13a8df-1465-4fbc-a612-ca7311c31ff2" \
-H "X-API-Key: YOUR_API_KEY"
[/Code]
### Response Parameters
Parameter | Type | Description
----------- | ------ | -------------
message | object | Message details
### message Object Fields
Parameter | Type | Description
----------- | ------ | -------------
id | string | Unique identifier of the message (UUID format)
from_address | string | Sender address
subject | string | Message subject
content | string | Message plain text content
html | string | Message HTML content (may be empty)
received_at | number | Received time (Unix timestamp in milliseconds)
### Response Example
[Code (json)]
{
"message": {
"id": "fd13a8df-1465-4fbc-a612-ca7311c31ff2",
"from_address": "sender1@example.com",
"subject": "Test Message 1 - xJOK2h",
"content": "Test Message 1\n\nThis is test message 1 content.\n\nBest regards,\nSender 1",
"html": "