Get All Threads

Purpose

This API is used to list all the threads in an account.

OAuth Scope

Use the scope

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

ALL - Full access to the messages.

READ - Read a thread.

To generate Authtoken, refer here.

Request URL

Method: GET

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

Path Parameters

  • account_key* string
    • This is a unique key to identify the account from which the threads have to be retrieved. It is generated during account addition.
    • This parameter can be fetched using the Get All Accounts API.

Query Parameters

  • folderId  long
    • This parameter specifies the ID of the folder for which the threads need to be retrieved. 
    • The default value is -1.
  • start int
    • This parameter specifies the starting sequence number of the threads to be retrieved.
    • The default value is 0.
  • limit int
    • This parameter specifies the number of threads to be retrieved from the start value mentioned.
    • The value can be between 1 to 200.
    • The default value is 25.
  • flagid string
    • Provide the flag ID to retrieve threads based on the specific flag.
    • The possible value can be
      • info
      • important
      • followup
      • flag_not_set
    • The default value is flag_not_set.
  • labelid long
    • Provide the label ID to retrieve threads 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 threads should be done.
    • The values can be 
      • date 
      • messageId 
      • size
    • The default value is date.
  • status string
    • This parameter determines whether to retrieve threads based on their read or unread status.
    • The value can be 
      • read
      • unread
  • attachedMails boolean
    • This parameter determines whether to retrieve the emails with attachments or all emails.  
    • The value can be 
      • true, to retrieve the emails with attachments. 
      • false, to retrieve all emails.
    • The default value is false.
  • inlinedMails boolean
    • This parameter determines whether to retrieve emails with inline images or all emails.
    • The value can be 
      • true, to retrieve the emails with inline images. 
      • false, to retrieve all emails.
    • The default value is false.
  • flaggedMails boolean
    • This parameter determines whether to retrieve flagged emails or all emails. 
    • The value can be 
      • true, to retrieve flagged emails.
      • false, to retrieve all emails.
    • The default value is false.
  • respondedMails boolean
    • This parameter determines whether to retrieve replied emails or all emails. 
    • 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/N7A**0CM/threads" \
-X GET \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization:Zoho-oauthtoken ***" \

Sample Success Response

Copied{
  "status": {
    "code": 200,
    "description": "success"
  },
  "data": [
    {
      "fromAddress": "rebecca@zylker.com",
      "messageId": "1676442580425110003",
      "folderId": "24803000000003009",
      "sender": "Rebecca",
      "summary": "4 From: Rebecca <rebecca@zylker.com> Sent: 07 February 2023 16:02 To: Rebecca <rebecca@zylker.com> Subject: Re: Threads 3 From: Rebecca <rebecca@zylker.com> Sent: 07 February 2023 16:02 To: Rebecca &l",
      "status": "0",
      "subject": "Re: Threads",
      "size": 3632,
      "hasAttachment": 0,
      "threadCount": 0,
      "receivedTime": "1675765984000",
      "toAddress": ""Rebecca"<rebecca@zylker.com>",
      "ccAddress": "Not Provided",
      "threadId": "1676442580425110003",
      "sentDateInGMT": "1675746184000",
      "flagid": "flag_not_set"
    },
    {
      "fromAddress": "rebecca@zylker.com",
      "messageId": "1676442580832110007",
      "folderId": "24803000000003009",
      "sender": "Rebecca",
      "summary": "3 From: Rebecca <rebecca@zylker.com> Sent: 07 February 2023 16:02 To: Rebecca <rebecca@zylker.com> Subject: Re: Threads 2 From: Rebecca <rebecca@zylker.com> Sent: 07 February 2023 16:02 To: Rebecca &l",
      "status": "0",
      "subject": "Re: Threads",
      "size": 2684,
      "hasAttachment": 0,
      "threadCount": 0,
      "receivedTime": "1675765978000",
      "toAddress": ""Rebecca"<rebecca@zylker.com>",
      "ccAddress": "Not Provided",
      "threadId": "1676442580425110003",
      "sentDateInGMT": "1675746178000",
      "flagid": "flag_not_set"
    },
    {
      "fromAddress": "rebecca@zylker.com",
      "messageId": "1676442581206110008",
      "folderId": "24803000000003009",
      "sender": "Rebecca",
      "summary": "2 From: Rebecca <rebecca@zylker.com> Sent: 07 February 2023 16:02 To: Rebecca <rebecca@zylker.com> Subject: Threads Hi",
      "status": "0",
      "subject": "Re: Threads",
      "size": 1742,
      "hasAttachment": 0,
      "threadCount": 0,
      "receivedTime": "1675765970000",
      "toAddress": ""Rebecca"<rebecca@zylker.com>",
      "ccAddress": "Not Provided",
      "threadId": "1676442581593110009",
      "sentDateInGMT": "1675746170000",
      "flagid": "flag_not_set"
    },
    {
      "fromAddress": "rebecca@zylker.com",
      "messageId": "1676442581593110009",
      "folderId": "24803000000003009",
      "sender": "Rebecca",
      "summary": "Hi",
      "status": "1",
      "subject": "Threads",
      "size": 821,
      "hasAttachment": 0,
      "threadCount": 0,
      "receivedTime": "1675765943000",
      "toAddress": ""Rebecca"<rebecca@zylker.com>",
      "ccAddress": "Not Provided",
      "threadId": "1676442580425110003",
      "sentDateInGMT": "1675746143000",
      "flagid": "flag_not_set"
    }
  ]
}

Sample Failure Response

Copied{
  "status": {
    "code": 500,
    "description": "Internal Error"
  },
  "data": {
    "moreInfo": "Internal Error"
  }
}