Skip to main content

Overview

Messages are the core of Jasni. Every email you send, receive, reply to, or forward is a message. The API provides full control over message operations.

Message Structure

FieldTypeDescription
uidintegerUnique identifier within the mailbox
messageIdstringRFC 2822 Message-ID header
fromstringSender email address
tostring[]Recipient email addresses
ccstring[]CC recipients
bccstring[]BCC recipients (only visible to sender)
subjectstringEmail subject line
datedatetimeWhen the email was sent/received
textstringPlain text body
htmlstringHTML body
attachmentsobject[]List of attachments
flagsstring[]IMAP flags (e.g., \Seen, \Flagged)

Operations

Send a Message

POST /api/v1/emails/send
{
  "from": "[email protected]",
  "to": ["[email protected]"],
  "subject": "Hello!",
  "text": "Plain text content",
  "html": "<p>HTML content</p>"
}
Always provide both text and html versions for maximum compatibility across email clients.

List Messages

GET /api/v1/[email protected]&folder=INBOX&limit=50

Read a Message

GET /api/v1/emails/[email protected]&folder=INBOX

Update Message Status

Mark as read:
PATCH /api/v1/emails/123[email protected]
{
  "action": "read"
}
Mark as unread:
PATCH /api/v1/emails/123[email protected]
{
  "action": "unread"
}

Delete a Message

DELETE /api/v1/emails/[email protected]
Deleting a message moves it to the Trash folder. It is not permanently deleted immediately.

Message Flags

Messages can have the following flags:
FlagDescription
\SeenMessage has been read
\FlaggedMessage is flagged/starred
\DraftMessage is a draft
\AnsweredMessage has been replied to

Best Practices

Some email clients don’t render HTML. Always include a plain text fallback.
Instead of polling, set up a webhook for email.received events to get instant notifications.
Always validate email addresses before sending to avoid bounces and protect your sender reputation.