API Reference
Zmail exposes two API surfaces:
- API key APIs for server-to-server calls
- Session APIs under
/app/api/*for product app and CLI
1. API Key APIs
Auth header:
Authorization: Bearer <ZMAIL_API_KEY>- Optional tenant scoping:
X-Tenant-ID: <tenant_id>
Health
GET /health
Mailboxes
GET /mailboxesPOST /mailboxes?address=<email>&description=<text>GET /mailboxes/{address}DELETE /mailboxes/{address}
Messages
GET /inbox?mailbox=&folder=inbox&limit=50&offset=0GET /messages/{message_id}?mark_read=truePOST /messages/{message_id}/read?read=truePOST /messages/{message_id}/move?folder=archiveDELETE /messages/{message_id}
Sending
POST /send- Body:
from_mailbox,to,subject,body, optionalhtml
Stats and Spam
GET /statsPOST /messages/{message_id}/spamPOST /messages/{message_id}/not-spam
2. Session APIs (/app/api/*)
Auth header:
X-Zmail-Session: <session_token>
Session and Workspace
POST /app/api/loginPOST /app/api/logoutGET /app/api/sessionPOST /app/api/workspaces/select
Mailboxes
GET /app/api/mailboxesPOST /app/api/mailboxes
Messages
GET /app/api/messagesGET /app/api/messages/{message_id}POST /app/api/messages/{message_id}/readPOST /app/api/messages/{message_id}/movePOST /app/api/messages/{message_id}/labelsGET /app/api/messages/{message_id}/threadGET /app/api/messages/{message_id}/attachmentsGET /app/api/messages/{message_id}/attachments/{attachment_id}
Threads
GET /app/api/threadsGET /app/api/threads/{thread_id}POST /app/api/threads/{thread_id}/labels
Drafts
GET /app/api/draftsPOST /app/api/draftsGET /app/api/drafts/{draft_id}PATCH /app/api/drafts/{draft_id}DELETE /app/api/drafts/{draft_id}POST /app/api/drafts/{draft_id}/send
Lists
GET /app/api/lists/{direction}/{list_type}POST /app/api/lists/{direction}/{list_type}GET /app/api/lists/{direction}/{list_type}/{entry:path}DELETE /app/api/lists/{direction}/{list_type}/{entry:path}
Outbound and Sent
POST /app/api/sendGET /app/api/sent
Webhooks
GET /app/api/webhooksPOST /app/api/webhooksGET /app/api/webhooks/{webhook_id}PATCH /app/api/webhooks/{webhook_id}DELETE /app/api/webhooks/{webhook_id}GET /app/api/webhooks/{webhook_id}/deliveriesPOST /app/api/webhooks/{webhook_id}/test
Response Conventions
- Success responses use object payloads and include
ok/successwhere appropriate. - Errors return JSON with
errorordetailand HTTP status code.
cURL Examples
# API-key mailbox list
curl -sS https://zerg-mail.com/mailboxes \
-H "Authorization: Bearer $ZMAIL_API_KEY" \
-H "X-Tenant-ID: 1"
# Session login
curl -sS https://zerg-mail.com/app/api/login \
-H "content-type: application/json" \
-d '{"email":"you@example.com","password":"***"}'
# Create webhook in active workspace
curl -sS https://zerg-mail.com/app/api/webhooks \
-H "content-type: application/json" \
-H "X-Zmail-Session: $SESSION" \
-d '{"url":"https://example.com/webhooks/zmail","event_types":["message.received"]}'