---
updatedAt: 2026-06-16T10:57:19.000Z
agentTools:
  projectIndex: https://partner-docs.gupshup.io/llms.txt
---

# Get Template Analytics for a template

This API endpoint retrieves analytics data for WhatsApp message templates. It provides insights into template performance including messages sent, delivered, read, and button clicks with flexible time ranges and granularity options.

> 📘 Note
>
> You will get the results in IST

# Rate Limiting

⚠️ **IMPORTANT**: Rate limiting applied

**Limit**: 5 requests per 60 seconds

**Purpose**: Prevents excessive analytics queries

**Exceeded**: Returns 429 Too Many Requests

<br />

# Important Notes

⚠️ **Key Considerations**

**Required Parameter**: template\_ids is mandatory

**Format**: Use comma-separated values for multiple templates

**Timestamps**: Unix epoch milliseconds or YYYY-MM-DD for start/end

**Granularity**: Choose based on analysis needs (AGGREGATED/DAILY)

**Data Freshness**: May have a slight delay from real-time

**Time Zones**: All timestamps in UTC

<br />

# To retrieve offsite conversion metrics, the same Template Analytics API must be invoked with additional parameters and constraints.

## Mandatory Changes for MM Lite

<br />

| Aspect              | Non–MM Lite          | MM Lite                        |
| :------------------ | :------------------- | :----------------------------- |
| product\_type       | CLOUD\_API (default) | MARKETING\_MESSAGES\_LITE\_API |
| use\_waba\_timezone | Optional / false     | Must be true                   |
| start, end format   | UNIX timestamp       | YYYY-MM-DD                     |
| Additional metrics  | Not supported        | Supported                      |

<br />

## Request Parameters

<HTMLBlock>{`
<table style="width: 100%; border-collapse: collapse;">
<thead>
<tr>
  <th style="border: 1px solid #ddd; padding: 8px;">Key</th>
  <th style="border: 1px solid #ddd; padding: 8px;">Description</th>
  <th style="border: 1px solid #ddd; padding: 8px;">Value</th>
  <th style="border: 1px solid #ddd; padding: 8px;">Type</th>
  <th style="border: 1px solid #ddd; padding: 8px;">Required/Optional</th>
  <th style="border: 1px solid #ddd; padding: 8px;">Constraints</th>
</tr>
</thead>
<tbody>

<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Authorization</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Access Token for the application</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>{{PARTNER_APP_TOKEN}}</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>String</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Required</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Should be a valid Partner App Access Token</p></td>
</tr>

<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>start</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>start time of the query</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>{{START}}</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Long</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Optional</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Epoch (If both start and end are not provided, default time corresponding to the last 30 days is populated in-code)</p></td>
</tr>

<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>end</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>end time of the query</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>{{END}}</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Long</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Optional</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Epoch (If both start and end are not provided, default time corresponding to the last 30 days is populated in-code)</p></td>
</tr>

<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>granularity</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>granularity of template analytics</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>{{GRANULARITY}}</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>String</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Optional</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>DAILY or AGGREGATED<br>Optional, if not provided, AGGREGATED is taken</p></td>
</tr>

<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>metric_types</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>comma-separated string for metrics to fetch template analytics</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>{{METRIC_TYPES}}</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>String</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Optional</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;">
    <p>COST

CLICKED

DELIVERED

READ

SENT

APP_ACTIVATIONS (MM Lite only)

APP_ADD_TO_CART (MM Lite only)

APP_CHECKOUTS_INITIATED (MM Lite only)

APP_PURCHASES (MM Lite only)

APP_PURCHASES_CONVERSION_VALUE (MM Lite only)

WEBSITE_ADD_TO_CART (MM Lite only)

WEBSITE_CHECKOUTS_INITIATED (MM Lite only)

WEBSITE_PURCHASES (MM Lite only)

WEBSITE_PURCHASES_CONVERSION_VALUE (MM Lite only)</p>
    <p>Optional, if not provided, all the above-mentioned metrics are considered</p>
  </td>
</tr>

<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>template_ids</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>comma-separated string for gs template ids</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>{{TEMPLATE_IDS}}</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>String</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Required</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Currently supports only 1 template at a time</p></td>
</tr>

<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>product_type</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;">
    <p>The product type of the metrics you want to retrieve. If omitted, only analytics for Cloud API will be returned.</p>
  </td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>CLOUD_API, MARKETING_MESSAGES_LITE_API</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Enum</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Optional</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Accepted values are: CLOUD_API, MARKETING_MESSAGES_LITE_API</p></td>
</tr>

<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>limit</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>no. of permitted entries in response per page; submitted during Meta call</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>{{LIMIT}}</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Integer</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Optional</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;">
    <p>Optional, if not provided, default is set to 30</p>
    <p>Currently, the limit is supported up to 30</p>
    <p>Impacts response only if granularity is DAILY</p>
  </td>
  </tr>
  <tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>use_waba_timezone</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Optional.

Whether to show metrics in the WABA’s configured timezone. If false or omitted, metrics will be shown in UTC.

If true, params start and end must be in the format YYYY-MM-DD.</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>{{USE_WABA_TIMEZONE}}</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Boolean</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Optional</p></td>
 
</tr>
<tr>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>appId</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>appId of the app to enable template analytics</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>{{APP_ID}}</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>String</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Required</p></td>
  <td style="border: 1px solid #ddd; padding: 8px;"><p>Should be a valid appId</p></td>
</tr>

</tbody>
</table>
`}</HTMLBlock>

## Sample Request

```curl
curl --location --request GET '{{BASE_URL}}/partner/app/{{APP_ID}}/template/analytics?start=1711935412&end=1712021812&granularity=DAILY&metric_types=SENT,DELIVERED,READ,CLICKED&template_ids={{TEMPLATE_ID}}&limit=30&product_type=MARKETING_MESSAGES_LITE_API' \
--header 'Authorization: {{PARTNER_APP_TOKEN}}'
```

## Sample Response

```
{
    "product_type": "MARKETING_MESSAGES_LITE_API",
    "status": "success",
    "template_analytics": [
        {
            "clicked": [
                {
                    "button_content": "Shop Now",
                    "count": 1,
                    "type": "unique_url_button"
                },
                {
                    "button_content": "Website",
                    "count": 1,
                    "type": "unique_url_button"
                },
                {
                    "button_content": "Shop Now",
                    "count": 1,
                    "type": "url_button"
                },
                {
                    "button_content": "Website",
                    "count": 1,
                    "type": "url_button"
                }
            ],
            "delivered": 3,
            "end": 1764633600,
            "read": 0,
            "sent": 3,
            "start": 1764547200,
            "template_id": "fb3ccce2-62a8-43b5-abff-824c33d160ec"
        }
    ]
}
```

## Status Codes

| Status Code | Response                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Comments                                                                                                                                                                                                       |
| :---------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Success** |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |                                                                                                                                                                                                                |
| 200         | `{       "status": "success",       "template_analytics": \[           {               "clicked": [                   {                       "button_content": "imgurl1",                       "count": 8,                       "type": "url_button"                   },                   {                       "button_content": "imgurl2",                       "count": 6,                       "type": "url_button"                   }               ],               "delivered": 2,               "end": 1706572800,               "read": 1,               "sent": 2,               "start": 1706400000,               "template_id": "2c679517-6450-4556-abff-a64d1355ee7e"           }       ]   }` | Successful response                                                                                                                                                                                            |
| 200         | `{       "status": "success",       "template_analytics": \[]   }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | When Meta’s API returns no data\_points (this is found to occur when template has no buttons, or template is authentication type, and button clicks are disabled and we query for only CLICKED as metric type) |
| **Error**   |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |                                                                                                                                                                                                                |
| 401         | `{       "status": "error",       "message": "Unauthorised access to the resource. Please review request parameters and headers and retry"   }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | Bad request                                                                                                                                                                                                    |
| 400         | `{       "message": "Start time can't be older than 90 days",       "status": "error"   }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |                                                                                                                                                                                                                |
| 404         | `{       "message": "Template Analytics settings for app f3bf7a6b-d694-412e-a5dd-6925c8bb2d15 does not exist",       "status": "error"   }`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |                                                                                                                                                                                                                |

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Partner Release 8.5 Apis",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://partner.gupshup.io"
    }
  ],
  "tags": [
    {
      "name": "Template Analytics"
    }
  ],
  "paths": {
    "/partner/app/{appId}/template/analytics": {
      "get": {
        "tags": [
          "Template Analytics"
        ],
        "summary": "Get Template Analytics for a template",
        "description": "This API endpoint retrieves analytics data for WhatsApp message templates. It provides insights into template performance including messages sent, delivered, read, and button clicks with flexible time ranges and granularity options.",
        "parameters": [
          {
            "name": "token",
            "in": "header",
            "schema": {
              "type": "string"
            },
            "description": "Your app token, please refer [**Get access token api**](https://docs.gupshup.io/reference/get_partner-app-appid-token) to get the token from partner documentation.",
            "example": "sk_61b3021c97214370b341f8baaae0xxxx",
            "required": true
          },
          {
            "name": "start",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "example": "1711929610",
            "required": true
          },
          {
            "name": "end",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "example": "1712188810",
            "required": true
          },
          {
            "name": "granularity",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Optional (default : AGGREGATE)",
            "example": "DAILY"
          },
          {
            "name": "metric_types",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Optional(Default: SENT,DELIVERED,READ,CLICKED)",
            "example": "SENT,DELIVERED,READ,CLICKED"
          },
          {
            "name": "template_ids",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "example": "100275e3-6c8f-477f-9671-780dd908xxxx",
            "required": true
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer"
            },
            "description": " linit should be in range of 0 -30",
            "example": "2",
            "required": true
          },
          {
            "name": "appId",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "example": "9e97650d-xxxx-xxxx-xxxx-4cdf47c3fa68",
            "required": true,
            "description": "Unique identification of the app"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "template_analytics": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "delivered": {
                            "type": "integer",
                            "format": "int32",
                            "example": "0"
                          },
                          "end": {
                            "type": "integer",
                            "format": "int32",
                            "example": "1712016000"
                          },
                          "read": {
                            "type": "integer",
                            "format": "int32",
                            "example": "0"
                          },
                          "sent": {
                            "type": "integer",
                            "format": "int32",
                            "example": "0"
                          },
                          "start": {
                            "type": "integer",
                            "format": "int32",
                            "example": "1711929600"
                          },
                          "template_id": {
                            "type": "string",
                            "example": "c0758280-9f0a-45d4-8452-c48c2d45c82f"
                          }
                        }
                      },
                      "example": [
                        {
                          "delivered": 0,
                          "end": 1712016000,
                          "read": 0,
                          "sent": 0,
                          "start": 1711929600,
                          "template_id": "c0758280-9f0a-45d4-8452-c48c2d45c82f"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Get_Template_analytics_bad_request1"
                }
              },
              "application/json ": {
                "schema": {
                  "$ref": "#/components/schemas/Get_Template_analytics_bad_request2"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "You do not have the required permissions to access this API"
                    },
                    "status": {
                      "type": "integer",
                      "example": 403
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string",
                      "example": "Internal server error. Please try again later and If Issue still persist than contact Gupshup Dev Support"
                    },
                    "status": {
                      "type": "integer",
                      "example": 500
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Get_Template_analytics_bad_request1": {
        "title": "Start time can't be older than 90 days",
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "error"
          },
          "message": {
            "type": "string",
            "example": "Start time can't be older than 90 days"
          }
        }
      },
      "Get_Template_analytics_bad_request2": {
        "title": "Template Analytics settings for app {{appId}} does not exist",
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "error"
          },
          "message": {
            "type": "string",
            "example": "Template Analytics settings for app {{appId}} does not exist"
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  }
}
```