Discover mailboxes
GET /v1/mailboxes (mailboxes:read) returns every mailbox the key can reach: the whole organization, or the domains and mailboxes its application is limited to. Use the mailbox id as mailboxId in every other call.
GET /v1/mailboxes
Authorization: Bearer $OMNERO_API_KEY
200 OK
{
"items": [
{ "id": "6f1c…", "address": "sales@acme.com", "displayName": "Sales" }
]
}
List messages
GET /v1/messages (messages:read) returns the newest messages first. Optional query parameters: mailboxId (UUID) to read one mailbox; folder (inbox, sent, drafts, archive, spam or trash); unread=true for unread messages only (unread=false for read ones); q to search text in the subject, sender address and text body (case-insensitive, up to 200 characters); limit (1–100, default 25) and cursor. Filters combine, and the cursor keeps them: send the same filters with every page. Pass nextCursor from the previous page as cursor to get older messages; nextCursor is null on the last page. Each item is a summary: preview holds the first 160 characters of the text body. Read the full message with its id.
GET /v1/messages?mailboxId=6f1c…&folder=inbox&unread=true&q=quote&limit=25
200 OK
{
"items": [
{
"id": "0b7e…",
"accountId": "6f1c…",
"direction": "inbound",
"status": "delivered",
"fromAddress": "ana@example.com",
"subject": "Quote request",
"preview": "Hi, could you send me…",
"folder": "inbox",
"isRead": false,
"createdAt": "2026-11-10T14:03:22.120Z"
}
],
"nextCursor": "2026-11-10T14:03:22.120Z"
}
Read one message
GET /v1/messages/{messageId} (messages:read) returns the full message. accountId is the mailbox that holds this copy. fromName is null when the sender sent no display name. textBody and htmlBody can each be null; render htmlBody only inside a sandbox and fall back to textBody. recipients lists to, cc and bcc with role. senderVerified is true when the sender domain passed DMARC. The id returned by POST /v1/messages can be read immediately; while the message is still queued it has status queued and no sizeBytes.
GET /v1/messages/0b7e…
200 OK
{
"message": {
"id": "0b7e…",
"accountId": "6f1c…",
"direction": "inbound",
"status": "delivered",
"folder": "inbox",
"isRead": false,
"isStarred": false,
"fromAddress": "ana@example.com",
"fromName": "Ana Pérez",
"subject": "Quote request",
"textBody": "Hi, could you send me a quote?",
"htmlBody": "<p>Hi, could you send me a quote?</p>",
"sizeBytes": 48211,
"senderVerified": true,
"recipients": [
{ "address": "sales@acme.com", "name": "Sales", "role": "to" },
{ "address": "boss@acme.com", "name": null, "role": "cc" }
],
"attachments": [
{
"id": "a91d…",
"filename": "specs.pdf",
"mediaType": "application/pdf",
"sizeBytes": 40112,
"sha256": "9f2c…",
"disposition": "attachment",
"contentId": null,
"available": true,
"createdAt": "2026-11-10T14:03:22.120Z"
}
],
"labels": [{ "id": "c3a0…", "name": "Clients" }],
"createdAt": "2026-11-10T14:03:22.120Z"
}
}
Field reference
Values your code can rely on. New optional fields may appear inside v1; ignore unknown fields.
- direction — inbound (received) or outbound (sent by the mailbox)
- status — queued, sending, sent, delivered, bounced, failed or opened
- folder — inbox, sent, archive, spam or trash
- isRead / isStarred — the mailbox state shared with Webmail and the mobile app
- recipients[].role — to, cc or bcc
- attachments[].disposition — attachment, or inline for images referenced by contentId in htmlBody
- attachments[].available — false while the file cannot be downloaded yet
- Dates are ISO 8601 in UTC; ids are UUIDs
Download an attachment
With attachments:read, call GET /v1/attachments/{attachmentId}/download-url. The response holds a url valid for sixty seconds plus filename, mediaType, sizeBytes and sha256. GET that url without the API key, stream the bytes and compare the SHA-256. Do not log or store the url. For small files, GET /v1/attachments/{attachmentId}/download returns the file inline as contentBase64.
// SDK: requests the URL, downloads and checks size and SHA-256.
const { filename, mediaType, bytes } = await omnero.attachments.downloadFile(attachmentId);
Change message state
PATCH /v1/messages/{messageId} (messages:write) takes mailboxId and at least one of isRead, isStarred or folder (inbox, sent, archive, spam, trash). The change is the same one Webmail makes and emits message.updated. The response is { "id": "…", "updated": true }.
PATCH /v1/messages/0b7e…
Content-Type: application/json
{ "mailboxId": "6f1c…", "isRead": true, "folder": "archive" }
Stay in sync
Subscribe to message.received for new mail instead of polling. After downtime, reconcile with GET /v1/events and then read the affected messages by id.
Search, drafts and replies
Search and filters are the folder, unread and q parameters of GET /v1/messages. To answer a message inside its conversation, send replyToMessageId with POST /v1/messages (see Send email). Drafts belong to one person's mailbox, so they live in the Mailbox API, together with labels: an integration that works for one mailbox can use GET/POST /v1/mailbox/drafts.