Email API
This guide will help you migrate the Emailing features of your application to API v2.
Methods changes
For each endpoint in the v1 API, here are the corresponding endpoints in the v2 API, along with the necessary modifications to achieve the same results.
Specifying the target accountThe
account_idparam, previously available either in the query params or in the body, is removed from all methods. Theaccount_idmust now be consistently included in the path params.
List all emails
GET /v1/emails
- For Google and Outlook, use
GET /v2/:account_id/emailsList all Emails. - ⚠️ For IMAP, Initial Sync must be enabled to use this route, otherwise use
GET /v2/:account_id/folders/:folder_id/emailsList folder Emails. - Query param
account_idis removed- Specify in the path param
- Query param
folderis removed- Use
GET /v2/:account_id/folders/:folder_id/emailsList folder Emails to get emails from a specific folder
- Use
- Query param
roleis removed- Sync folders list on your side and use
folder_idin List folder Emails
- Sync folders list on your side and use
- Query param
include_headersis removed- Headers are always present
- Response shape has changed (see Email object changes)
Send an email
POST /v1/email
- Use
POST /v2/:account_id/emails/sendSend an Email - Content-Type have changed from
multipart/form-datatoapplication/json - Body param
reply_tochanged- For Gmail and Outlook, this is the provider ID for the email message that you're replying to (
idin the Email object). For IMAP, this is the RFC822 Message-ID header of the email message that you're replying to.
- For Gmail and Outlook, this is the provider ID for the email message that you're replying to (
- Body param
account_idis removed- Specify in the path param
- Body param
attachmentshas changed- Specify an array of objects with
filename,content_typeandcontentas base64
- Specify an array of objects with
- Body param
bodyis removed- Use
plain_textandhtml
- Use
Retrieve an email
GET /v1/emails/:email_id
- Use
GET /v2/:account_id/emails/:email_idGet an Email - Query param
account_idis removed- Specify in the path param
- Query param
include_headersis removed- Headers are always present
- Response shape has changed (see Email object changes)
Delete an email
DELETE /v1/emails/:email_id
- Use
DELETE /v2/:account_id/emails/:email_idTrash an Email - Query param
account_idis removed- Specify in the path param
- Path param email_id changed
- Use the
idof the Email object
- Use the
Update an email
PUT /v1/emails/:email_id
- Route is removed
- Use
POST /v2/:account_id/emails/:email_id/readRead an Email to mark email as read - Use
POST /v2/:account_id/emails/:email_id/unreadUnread an Email to mark email as unread - Use
POST /v2/:account_id/emails/:email_id/modifyModify an Email to move folders, update labels, or set provider-specific properties
- Use
- Body param
data(partial Mail object) is removed- Use
folders_idsto move the email to specific folder(s) - Use
specifics.{provider}for provider-specific properties (see below)
- Use
- Body param
folders_idsis optional- Required for IMAP. If omitted, the email is not moved — useful when only updating provider-specific properties (e.g. categories)
- Body param
categoriesmoved tospecifics.outlook.categories- Previously:
{ categories: ["Project X"] } - Now:
{ specifics: { outlook: { categories: ["Project X"] } } } - Same behavior: categories that don't exist yet in the account's master categories are automatically created with the color
"None"
- Previously:
- Move and categories can now be combined in a single request
- Previously required separate calls (
move+updateMail) - Now:
{ folders_ids: ["folder_id"], specifics: { outlook: { categories: ["Urgent"] } } }
- Previously required separate calls (
Retrieve an attachment from an email
GET /v1/emails/:email_id/attachments/:attachment_id
- Use
GET /v2/:account_id/emails/:email_id/attachments/:attachment_idGet an Email Attachment - Query param
account_idis removed- Specify in the path param
List all folders
GET /v1/folders
- Use
GET /v2/:account_id/foldersList all Folders - Query param
account_idis removed- Specify in the path param
- Route is now paginated and don't return all folders
- Response shape has changed (see Folder object changes)
Retrieve a folder
GET /folders/:folder_id
- Use
GET /v2/:account_id/folders/:folder_idGet a Folder - Path param
folder_idis changed- Use the
idof the Folder object (must not be a Unipile ID)
- Use the
- Query param
account_idis removed- Specify in the path param
- Response shape has changed (see Folder object changes)
List all Contacts
GET /contacts
- Response shape has changed (see Contact object changes)
Email object changes
| v1 field | v2 change |
|---|---|
id | This field value is now the value of the v1 provider_id |
kind | Removed |
type | Removed |
role | Removed, refer to the folders |
folders | This is now an array of Folder object id. |
folderIds | Removed |
read_date | Removed, use is_unread |
message_id | Removed, use headers |
provider_id | Renamed to id |
Folder object changed
| v1 field | v2 change |
|---|---|
id | This field value is now the value of the v1 provider_id |
provider_id | Renamed to id |
nb_mails | Renamed to total_count |
role | Roles now match. the Special-Use attributes. Read more in Manage mailboxes. |
Contact object changed
| v1 field | v2 change |
|---|---|
source | This field has been removed |
surname | Renamed to last_name |
given_name | Renamed to first_name |
nickname | Renamed to display_name |
birthday | Renamed to birth_date |
Updated about 2 months ago