List All Emails in a Folder

Purpose

This API lists all emails in a specified folder of an account.

OAuth Scope

Use the scope

MailApps.messages.ALL (or) MailApps.messages.READ

ALL - Full access to the messages.

READ - Read emails.

To generate Authtoken, refer here.

Request URL

Method: GET

https://mail360.zoho.com/api/accounts/{account_key}/messages

Path Parameters

  • account_key* string
    • This key is used to identify the account from which the emails have to be retrieved. It is generated during account addition.
    • This parameter can be fetched from Get all accounts API.

Query Parameters

  • folderId  long
    • This parameter specifies the folder ID of the folder from which the emails need to be retrieved. 
    • This can be fetched using the Get all folders API.
  • start int
    • This parameter specifies the starting sequence number of the emails to be retrieved.
    • The default value is 1.
  • limit int
    • This parameter specifies the number of emails to be retrieved from the start value mentioned.
    • The value can be between 1 to 200.
    • The default value is 10.
  • flagid int
    • Provide the flag ID to retrieve emails based on the specific flag.
    • The value can be between 0 to 9.
    • The default value is 0.
  • labelId long
    • Provide the label ID to retrieve emails based on the specific label.
    • The default value is 0.
  • sortorder boolean
    • This parameter specifies the sort order of the retrieved list, allowing you to indicate whether ascending or descending order is required.
    • The value can be 
      • true, for ascending order 
      • false, for descending order
    • The default value is false.
  • includesent boolean
    • This parameter allows you to indicate whether sent emails need to be included or not on the list of emails retrieved.
    • The value can be 
      • true, to include sent emails
      • false, to not include sent emails.
    • The default value is false.
  • sortBy string
    • This parameter specifies on which basis the sorting of the list of emails should be done.
    • The values can be 
      • date 
      • messageId 
      • size
    • The default value is date.
  • status string
    • Provide this parameter to retrieve emails by read or unread status. 
    • The value can be 
      • read
      • unread
  • attachedMails boolean
    • Provide this parameter to retrieve only the emails with attachments.  
    • The value can be 
      • true, to retrieve the emails with attachments. 
      • false, to retrieve all emails.
    • The default value is false.
  • inlinedMails boolean
    • Provide this parameter to retrieve only the emails with inline images. 
    • The value can be 
      • true, to retrieve the emails with inline images. 
      • false, to retrieve all emails.
    • The default value is false.
  • flaggedMails boolean
    • Provide this parameter to retrieve only flagged emails. 
    • The value can be 
      • true, to retrieve flagged emails.
      • false, to retrieve all emails.
    • The default value is false.
  • respondedMails boolean
    • Provide this parameter to retrieve only emails with replies.
    • The value can be 
      • true, to retrieve emails with replies.
      • false, to retrieve all emails.
    • The default value is false.

 

* - Mandatory parameter

Note:

While the Messages APIs focus on individual messages, the Threads APIs deal with entire conversation threads, each of which contains multiple messages.

Sample request

Copiedcurl "https://mail360.zoho.com/api/accounts/Gcc**CM/messages?folderId=293**002014" \
-X GET \
-H "Accept: application/json" \
-H "Authorization:Zoho-oauthtoken ***" 

Sample response

Copied{
    "status": {
        "code": 200,
        "description": "success"
    },
    "data": [
        {
            "summary": "Email recovery status - Success Hello Rebecca. The email recovery initiated for the account rebecca@zylker.com has been completed. The deleted emails were recovered to the folder deleted. Do not hesitate to write to us at support@zohomail.com in ca",
            "sentDateInGMT": "1551307312000",
            "calendarType": 0,
            "subject": "Email recovery - Consolidated status for rebecca@zylker.com",
            "messageId": "1586349970129010002",
            "flagid": "flag_not_set",
            "status2": "0",
            "priority": "3",
            "hasInline": "true",
            "toAddress": "<admin@zm.m100.org>",
            "folderId": "2452000000003161",
            "ccAddress": "Not Provided",
            "hasAttachment": "0",
            "size": "1640",
            "sender": "noreply@zohosmtpin.india.adventnet.com",
            "receivedTime": "1551327112000",
            "fromAddress": "noreply@zohosmtpin.india.adventnet.com",
            "status": ""
        }
    ]
}