Appearance
Messages
Fetch, read, and delete emails. All endpoints require authentication.
List Messages
GET /api/messagesReturns a paginated list of messages in the mailbox (30 messages per page).
Parameters
| Name | In | Type | Default | Description |
|---|---|---|---|---|
page | query | integer | 1 | Page number (≥ 1) |
Pagination
- Each page returns up to 30 messages, ordered by newest first
- If fewer than 30 messages are returned, you've reached the last page
- There is no
totalfield — check if the returned count is less than 30 to stop paginating
Request
bash
curl https://api.mail.cx/api/messages?page=1 \
-H "Authorization: Bearer YOUR_TOKEN"Response 200
json
{
"messages": [
{
"id": "f5e6d7c8-a1b2-3c4d-e5f6-789012345678",
"sender": "noreply@example.com",
"from": "Example Service <noreply@example.com>",
"subject": "Verify your email address",
"preview_text": "Click the link below to verify your email...",
"size": 4523,
"created_at": "2025-01-15T10:30:00Z"
}
],
"page": 1
}Message Summary Fields
| Field | Type | Description |
|---|---|---|
id | uuid | Message ID |
sender | string | Envelope sender address |
from | string | From header (display name + address) |
subject | string | Subject line |
preview_text | string | First ~100 characters of the message body |
size | integer | Message size in bytes |
created_at | string | Received timestamp (ISO 8601) |
Get a Message
GET /api/messages/{id}Returns the full message content including HTML body and attachments.
Request
bash
curl https://api.mail.cx/api/messages/f5e6d7c8-a1b2-3c4d-e5f6-789012345678 \
-H "Authorization: Bearer YOUR_TOKEN"Response 200
json
{
"id": "f5e6d7c8-a1b2-3c4d-e5f6-789012345678",
"sender": "noreply@example.com",
"from": "Example Service <noreply@example.com>",
"subject": "Verify your email address",
"address": "demo@mail.cx",
"size": 4523,
"created_at": "2025-01-15T10:30:00Z",
"text_body": "Click the link below to verify your email:\nhttps://example.com/verify?token=abc123",
"html_body": "<html><body><p>Click the link below...</p></body></html>",
"attachments": [
{
"index": 0,
"filename": "receipt.pdf",
"content_type": "application/pdf",
"size": 24680
}
]
}Full Message Fields
| Field | Type | Description |
|---|---|---|
id | uuid | Message ID |
sender | string | Envelope sender address |
from | string | From header |
subject | string | Subject line |
address | string | Recipient address (your mailbox) |
size | integer | Message size in bytes |
created_at | string | Received timestamp |
text_body | string? | Plain text body (null if not present) |
html_body | string? | HTML body (null if not present) |
attachments | array | List of attachments |
Attachment Fields
| Field | Type | Description |
|---|---|---|
index | integer | Attachment index (for download) |
filename | string | Original file name |
content_type | string | MIME type |
size | integer | Size in bytes |
Errors
| Status | Error Code | Description |
|---|---|---|
| 404 | not_found | Message does not exist |
| 410 | expired | Message has expired |
Delete a Message
DELETE /api/messages/{id}Request
bash
curl -X DELETE https://api.mail.cx/api/messages/f5e6d7c8-... \
-H "Authorization: Bearer YOUR_TOKEN"Response 204
No content. Message has been deleted.
Download Raw Source
GET /api/messages/{id}/sourceDownload the raw EML (RFC 822) source of an email. Useful for debugging or archival.
Request
bash
curl https://api.mail.cx/api/messages/f5e6d7c8-.../source \
-H "Authorization: Bearer YOUR_TOKEN" \
-o email.emlResponse 200
Returns the raw email source with Content-Type: message/rfc822.
Download Attachment
GET /api/messages/{id}/attachments/{index}Download a specific attachment by its index.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id | path | uuid | Message ID |
index | path | integer | Attachment index (from message detail) |
Request
bash
curl https://api.mail.cx/api/messages/f5e6d7c8-.../attachments/0 \
-H "Authorization: Bearer YOUR_TOKEN" \
-o receipt.pdfResponse 200
Returns the attachment binary with appropriate Content-Type and Content-Disposition headers.
Errors
| Status | Error Code | Description |
|---|---|---|
| 400 | invalid_index | Index out of range |
| 404 | not_found | Message not found |
| 410 | expired | Message has expired |