Skip to main content
GET
/
api
/
v1
/
emails
curl -X GET "https://api.jasni.ai/api/v1/[email protected]&folder=INBOX&limit=10" \
  -H "Authorization: Bearer jsk_your_api_key"
{
  "success": true,
  "data": {
    "emails": [
      {
        "uid": 12345,
        "messageId": "<[email protected]>",
        "from": "[email protected]",
        "to": ["[email protected]"],
        "subject": "Hello!",
        "date": "2024-01-15T10:30:00Z",
        "text": "Plain text preview...",
        "flags": ["\\Seen"]
      },
      {
        "uid": 12344,
        "messageId": "<[email protected]>",
        "from": "[email protected]",
        "to": ["[email protected]"],
        "subject": "Important update",
        "date": "2024-01-15T09:15:00Z",
        "text": "Another email preview...",
        "flags": []
      }
    ],
    "folder": "INBOX",
    "total": 2,
    "account": "[email protected]"
  }
}

Request

account
string
required
Email account to fetch from (e.g., [email protected])
folder
string
default:"INBOX"
Folder to fetch from. Common folders: INBOX, Sent, Drafts, Trash, Spam
limit
integer
default:"50"
Number of emails to fetch (max 100)

Response

success
boolean
Indicates if the request was successful
data
object
curl -X GET "https://api.jasni.ai/api/v1/[email protected]&folder=INBOX&limit=10" \
  -H "Authorization: Bearer jsk_your_api_key"
{
  "success": true,
  "data": {
    "emails": [
      {
        "uid": 12345,
        "messageId": "<[email protected]>",
        "from": "[email protected]",
        "to": ["[email protected]"],
        "subject": "Hello!",
        "date": "2024-01-15T10:30:00Z",
        "text": "Plain text preview...",
        "flags": ["\\Seen"]
      },
      {
        "uid": 12344,
        "messageId": "<[email protected]>",
        "from": "[email protected]",
        "to": ["[email protected]"],
        "subject": "Important update",
        "date": "2024-01-15T09:15:00Z",
        "text": "Another email preview...",
        "flags": []
      }
    ],
    "folder": "INBOX",
    "total": 2,
    "account": "[email protected]"
  }
}

Notes

  • If no account parameter is provided, the endpoint returns a list of available email accounts instead of emails
  • The limit parameter has a maximum value of 100
  • Emails are returned in reverse chronological order (newest first)
  • The flags array contains IMAP flags like \Seen (read), \Flagged (starred), etc.