Email API Overview
The Nylas Email API gives you a secure, reliable connection to your user’s inboxes that enables you to sync historic and live email data into your application in real-time and perform bi-directional email sync with full CRUD (create, read, update, delete) for most email providers.
The Nylas Email API provides a REST interface that includes functionality to:
- Read data from email messages and threads, such as email content, sender and recipient information, subject lines, dates, and more.
- Organize email inboxes with labels and folders.
- Update the unread and starred status of email messages.
- Manage and download file attachments.
- Create drafts and send emails.
- Search email inboxes for specific content.
This section covers all of the endpoints the Nylas Email API provides to enable you to integrate full email functionality into your app.
Messages are the fundamental object of the Nylas platform and the core building block for most email applications. They contain several pieces of information, such as when a message was sent, the sender's address, to whom it was sent, and the message body. They can also contain file attachments, calendar event invitations, and more.
Threads are multiple messages that are grouped together into a single, first-class object. Nylas threads messages together using a variety of heuristics; on Gmail and Microsoft Exchange accounts, messages are threaded together as close as possible to the representation in those environments. For all other providers (including generic IMAP), messages are threaded using a custom JWZ-inspired algorithm.
Emails forwarded to other people in a thread remain in the thread on the provider and Nylas.
Folders are the primary component for organizing email inboxes from most providers and they behave like regular IMAP or filesystem folders. A message can only be contained within a single folder, but a thread with many messages might span multiple folders.
Gmail uses labels to organize email inboxes rather than folders, and messages may have more than one label. Nylas makes it easy to detect when accounts use this method of organization so you can ensure your end users have an experience that matches their provider of choice.
When adding and removing certain Gmail label, Nylas follows the provider rules.
- Adding one of All Mail, Trash, or Spam removes the other 2.
- Adding the Trash or Spam label also removes the Inbox label.
- Adding the Inbox label removes a message's Trash or Spam labels and adds back the All Mail label, if needed.
Files are any data attached to messages. Nylas allows you to download existing attachments from messages and threads and upload new files to be sent.
Drafts are a special kind of message that has not been sent, and therefore its body contents and recipients are still mutable. The drafts endpoints let you read and modify existing drafts, create new drafts, send drafts, and delete drafts.