Get SMTP Logs

Purpose

This API retrieves SMTP logs for email transactions.

OAuth Scope

Use the scope

ZohoMail.partner.organization.ALL (or) ZohoMail.partner.organization.READ

to generate the Authtoken.

ALL - Full access to the organization.

READ - Read access to organization.

Request URL

Method: GET

https://mail.zoho.com/api/organization/{zoid}/smtplogs

Path Parameters

  • zoid* long
    • This parameter denotes the unique Zoho Organization Identifier for the organization.
    • This parameter can be retrieved from the Get Organization Details API.

 

Request Body ( JSON Object)

  • fromDateTime* long
    • Specifies the starting date and time from which SMTP logs are requested.
    • The value of this parameter should be provided in milliseconds since the Unix epoch (January 1, 1970, 00:00:00 UTC).
  • toDateTime* long
    • Specifies the ending date and time for the requested SMTP logs.
    • The value of this parameter should be provided in milliseconds since the Unix epoch (January 1, 1970, 00:00:00 UTC).
  • searchCriteria* string
    • Specifies the criteria for searching logs.
    • Allowed values:
      • messageId
      • fromAddr
      • toAddr
  • searchKey* string
    • Provide the relevant search key based on searchCriteria.
  • limit* int
    • This parameter specifies the maximum number of logs to retrieve.
    • Allowed value : 1-500.
    • The default value is 10.
  • isNext* boolean
    • This parameter indicates whether the API request is for retrieving the next set of SMTP logs. 
    • During the first iteration, the value should be set to false. For subsequent iterations to retrieve the next set of SMTP logs, set this parameter to true.
  • pageKey* string
    • When isNext is set to false during the first iteration, pageKey remains empty. However, during subsequent iterations when isNext is set to true to retrieve the next set of SMTP logs, pageKey contains the value provided in the response from the previous iteration.
  • isPrevious* boolean
    • This parameter indicates whether the API request is intended to retrieve the previous set of SMTP logs. 
    • During the initial request and the second iteration, isPrevious is set to false. Subsequently, when attempting to retrieve the previous set of logs, isPrevious should be set to true
  • prevKey* string
    •  When isPrevious is set to false during the first and second iterations, prevKey remains empty. However, during subsequent iterations when isPrevious is set to true to retrieve the previous set of SMTP logs, prevKey contains the value provided in the response from the previous iteration, accessible through the parameter named pagePrevKey.
  • isReverseSearch boolean
    • This parameter specifies whether the search results should be returned in ascending or descending order based on the specified search criteria.
    • Allowed values :
      • true - The results will be returned in ascending order.
      • false - The results will be returned in descending order.

         

 

* - Mandatory parameter

 

Response Codes

Refer here for the response codes and their meaning.

Sample Request

Copiedcurl "https://mail.zoho.com/api/organization/12345678/smtplogs" \
-X GET \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization:Zoho-oauthtoken ***"\
-d '{
  "isNext": false,
  "isPrevious": false,
  "pageKey": "false",
  "prevKey": "false",
  "searchKey": "admin@zylker.com",
  "fromDateTime": 1706725800000,
  "toDateTime": 1708799399999,
  "searchCriteria": "fromAddr",
  "limit": 100,
  "isReverseSearch": true
}'

Sample Response

Copied{
    "status": {
        "code": 200,
        "description": "success"
    },
    "data": {
        "hnxt": "true",
        "response": [
            {
                "mailType": "out",
                "recipients": [
                    {
                        "rcpt": "rebecca@zylker.com",
                        "deliveryStatus_i18n": "Mail Moderated",
                        "relay": "zohomail.com.in",
                        "deliveryType": "MAILBOX DELIVERY",
                        "time": "02/28/2024 20:02:48.790",
                        "isSpam": "No",
                        "isSpam_i18n": "No",
                        "timeMillis": 1709130768790,
                        "deliveryStatus": "Mail Moderated"
                    }
                ],
                "from": {
                    "reason": "",
                    "sentTimeMillis": 1709130686455,
                    "remoteIP": "mail.zoho.com",
                    "authEmailId": "admin@zylker.com",
                    "subject": "Data Loading for group traffic",
                    "msgId": "<18df0209fca.ef4d27e03.3622346607191255359@sathak.com>",
                    "zoid": "57047751",
                    "zuid": "57047795",
                    "protocol": "HTTP",
                    "size": 9000,
                    "sender": "admin@zylker.com",
                    "nRcpts": 1,
                    "clientIP": "admin",
                    "sentTime": "02/28/2024 20:01:26.455",
                    "from": "admin@zylker.com",
                    "mailSize": 9000
                },
                "mailType_i18n": "Outbound",
                "TransactionID": "3eeb41ca-2a29-4d4a-91a7-7b78e590aaf5",
                "isRecallable": true
            }
        ],
        "previousClickedState": true,
        "hasPrevious": "true",
        "pagekey": "ZO:57047751_F:admin@zylker.com_1709389883361000_5f32d1dd-1b51-4cbd-a9ef-0e0afac7f71f",
        "nextClickedState": false,
        "pagePrevKey": "ZO:57047751_F:admin@zylker.com_1709130686455000_3eeb41ca-2a29-4d4a-91a7-7b78e590aaf5"
    }
}