## 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": "
\n

Test Message 1

\n
", "received_at": 1745224245084 } } [/Code] ## Delete Message Delete the specified message. ### Request [Code (bash)] DELETE /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 -X DELETE "https://chat-tempmail.com/api/emails/76d91ae5-822a-4fdd-8701-9de038ec86d7/20e77445-b0c3-4e8b-aa29-762ea423ac15" \ -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] --- ## Webhook Push Configure webhook to receive message push notifications ## Get Webhook Configuration Get current webhook configuration information. ### Request [Code (bash)] GET /api/webhook [/Code] ### Request Example [Code (bash)] curl https://chat-tempmail.com/api/webhook \ -H "X-API-Key: YOUR_API_KEY" [/Code] ### Response Parameters Parameter | Type | Description ----------- | ------ | ------------- url | string | Webhook URL address (may be empty string) enabled | boolean | Whether webhook is enabled ### Response Example [Code (json)] { "url": "https://your-server.com/webhook", "enabled": true } [/Code] ## Configure Webhook Set or update webhook configuration. ### Request [Code (bash)] POST /api/webhook [/Code] ### Request Parameters Parameter | Type | Required | Description ----------- | ------ | ---------- | ------------- url | string | Yes | Webhook URL address (must be valid HTTP/HTTPS URL) enabled | boolean | Yes | Whether to enable webhook ### Request Example [Code (bash)] curl -X POST https://chat-tempmail.com/api/webhook \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://your-server.com/webhook", "enabled": true }' [/Code] ### Response Parameters Parameter | Type | Description ----------- | ------ | ------------- success | boolean | Whether configuration was successful ### Response Example [Code (json)] { "success": true } [/Code] ## Webhook Events When a new message arrives, the system will send a POST request to your configured URL. ### Received Data Format Request Headers: - Content-Type: application/json - X-Webhook-Event: new_message ### Webhook Push Data Parameter | Type | Description ----------- | ------ | ------------- emailId | string | Email ID that received the message (UUID format) messageId | string | New message ID (UUID format) fromAddress | string | Sender address subject | string | Message subject content | string | Message plain text content html | string | Message HTML content (may be empty) receivedAt | string | Message received time (ISO 8601 format) toAddress | string | Email address that received the message ### Push Data Example [Code (json)] { "emailId": "c2c4f894-c672-4d5b-a918-abca95aff1f7", "messageId": "fd13a8df-1465-4fbc-a612-ca7311c31ff2", "fromAddress": "sender@example.com", "subject": "Test Message", "content": "Message plain text content", "html": "
Message HTML content
", "receivedAt": "2025-01-21T08:30:45.084Z", "toAddress": "test@chat-tempmail.com" } [/Code] ### Response Requirements Your server should return a 2xx status code to indicate successful receipt. If a non-2xx status code is returned, the system may retry sending. Recommended Response: [Code (json)] HTTP/1.1 200 OK Content-Type: application/json { "received": true } [/Code] ### Important Notes - Ensure your webhook URL is accessible - It's recommended to verify the integrity of push data on your server side - The system will send webhook pushes immediately when messages arrive - If pushes fail, the system may retry, so ensure your interface is idempotent ---