Get Message Headers of an Email

Purpose

The API retrieves the internet message headers of a particular email, based on the message ID passed as the request parameter. 

OAuth Scope

Use the scope

ZohoMail.messages.ALL (or) ZohoMail.messages.READ

to generate the Authtoken.

ALL - Grants full access to messages.

READ - Grants access to read messages.

Request URL

Method: GET

https://mail.zoho.com/api/accounts/{accountId}/folders/{folderId}/messages/{messageId}/header

Path Parameters

  • accountId* long
    • This parameter is used to identify the specific account to fetch details.
    • This parameter can be retrieved from the Get User Account Details API.
  • folderId* long
    • This parameter is used to identify the specific folder for which the emails need to be retrieved. 
    • This parameter can be retrieved from the Get All Folders API.
  • messageId* long
    • This parameter is the unique ID associated with the particular email. 
    • This parameter can be retrieved from List Emails API.

 

Query Parameters

  • raw boolean
    • This parameter is used to specify the response format of message headers.
    • Allowed values :
      • true - To retrieve response in raw format.
      • false - To retrieve response in JSON format.
    • The default value is true.

 

* - Mandatory parameter

Response Codes

Refer here for the response codes and their meaning.

Sample Request

Copiedcurl "https://mail.zoho.com/api/accounts/12345678/folders/9000000002014/messages/1710915488416100000/header" \
-X GET \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization:Zoho-oauthtoken *****"

Sample Response(when raw = true)

Copied{
  "status": {
    "code": 200,
    "description": "success"
  },
  "data": {
    "headerContent": "Received: from mail.zoho.com by zohomail.com.in\r\n\twith SMTP id 1710915503001464.8172454726922; Wed, 20 Mar 2024 11:48:22 +0530 (IST)\r\nDate: Wed, 20 Mar 2024 11:48:06 +0530\r\nFrom: Rebecca <Rebecca@zylker.com>\r\nTo: \"Paula\" <Paula@zylker.com>\r\nMessage-Id: <18e5a828422.b64e1ac10.3955673754999231544@140.com>\r\nSubject: Hello\r\nMIME-Version: 1.0\r\nContent-Type: multipart/mixed; \r\n\tboundary=\"----=_Part_324_1916164368.1710828056044\"\r\nImportance: Medium\r\nUser-Agent: Zoho Mail\r\nX-Mailer: Zoho Mail\r\nX-Zoho-Virus-Status: 1\r\nX-Zoho-Virus-Status: 1\r\n",
    "messageId": 1710915488416100000
  }
}

Sample Response(when raw = false)

Copied{
  "status": {
    "code": 200,
    "description": "success"
  },
  "data": {
    "headerContent": {
      "Importance": [
        "Medium"
      ],
      "X-Mailer": [
        "Zoho Mail"
      ],
      "X-Zoho-Virus-Status": [
        "1",
        "1"
      ],
      "Received": [
        "from mail.zoho.com by zohomail.com.in\r\n\twith SMTP id 1710915503001464.8172454726922; Wed, 20 Mar 2024 11:48:22 +0530 (IST)"
      ],
      "User-Agent": [
        "Zoho Mail"
      ],
      "From": [
        "Vigneshwaran <vigneshwaran@vapps.com>"
      ],
      "To": [
        "\"Silva\" <silva@140.com>"
      ],
      "Message-Id": [
        "<18e5a828422.b64e1ac10.3955673754999231544@140.com>"
      ],
      "Date": [
        "Wed, 20 Mar 2024 11:48:06 +0530"
      ],
      "Subject": [
        "Hello"
      ],
      "MIME-Version": [
        "1.0"
      ],
      "Content-Type": [
        "multipart/mixed; \r\n\tboundary=\"----=_Part_324_1916164368.1710828056044\""
      ]
    },
    "messageId": 1710915488416100000
  }
}