Overview
Jasni provides a complete email API that enables your AI agents to communicate autonomously. Send, receive, read, reply, and forward emails—all programmatically through your agent’s inbox.Agent Inboxes
Before your agent can work with emails, it needs an inbox—its own email identity. You can:- Create a new identity: Set up a fresh email address with your custom domain for your agent
- Connect an existing account: Give your agent access to an existing email provider (Gmail, Outlook, custom IMAP)
Each inbox is linked to your Jasni account. Your agents can only access emails from inboxes you’ve configured.
Email Structure
An email object in Jasni contains the following fields:| Field | Type | Description |
|---|---|---|
uid | integer | Unique identifier within the mailbox |
messageId | string | RFC 2822 Message-ID header |
from | string | Sender email address |
to | string[] | Recipient email addresses |
cc | string[] | CC recipients |
subject | string | Email subject line |
date | datetime | When the email was sent/received |
text | string | Plain text body |
html | string | HTML body |
attachments | object[] | List of attachments |
flags | string[] | IMAP flags (e.g., \Seen, \Flagged) |
Operations
Listing Emails
Fetch emails from any folder in your mailbox:INBOX- Incoming emailsSent- Sent emailsDrafts- Draft emailsTrash- Deleted emailsSpamorJunk- Spam folder
Reading an Email
Fetch a specific email by its UID:Sending Emails
Send a new email from one of your accounts:Replying to Emails
Reply to an existing email with proper threading:- Sets the correct
In-Reply-ToandReferencesheaders - Determines the correct recipients
- Adds
Re:prefix to the subject - Quotes the original message (if
includeOriginalis true)
Forwarding Emails
Forward an email to new recipients:Updating Email Status
Mark emails as read or unread:Deleting Emails
Move an email to trash:Threading
Email threading is automatically handled by Jasni. When you reply to or forward an email, the proper headers are set:- Message-ID: Unique identifier for each email
- In-Reply-To: References the parent email’s Message-ID
- References: Full chain of Message-IDs in the thread
Attachments
When listing or reading emails, attachment metadata is included:Attachment download endpoints are available for fetching actual attachment content.
Best Practices for AI Agents

Use webhooks for instant reactions
Use webhooks for instant reactions
Set up webhooks for
email.received events so your agent can react immediately. Polling adds latency and wastes resources.
Maintain conversation context
Maintain conversation context
Use the References header to track email threads. This helps your agent understand conversation history and respond contextually.

Validate before sending
Validate before sending
Have your agent validate recipient email addresses before sending to avoid bounces and maintain sender reputation.

Respect rate limits
Respect rate limits
Implement proper rate limiting in your agent to avoid hitting API limits, especially when processing large volumes.