Template Analytics
GET Method
The Template Analytics API allows you to get the details of the number of times a template has been sent, delivered, read, as well as the number of times URL buttons or Quick Reply buttons in the template have been clicked.
You can filter the template analytics associated with a WABA ID based on the following options:
- WhatsApp Template IDs.
- Date Range (Start Date and End Date) to which analytics refers to.
- Granularity by which you would like to retrieve the analytics. Only daily is supported in this API.
- WhatsApp Product Type for which analytics are requested. The types of messages (notification messages or customer support messages) for which you want to retrieve notifications.
- Metric Types for which you want to retrieve. For example, sent, delivered, read, clicked, or replied.
Limitations
- Template Analytics are available through the Kaleyra WhatsApp API V2 only if the account has not opted into Cloud API template analytics.
- Kaleyra API template analytics are subject to aggregation and anonymization guidelines, which require that there be a minimum of 1000 events for the given template before the count is displayed.
- Button click analytics are only available for templates categorized as MARKETING or UTILITY.
- WABAs owned by or shared with Meta Business Accounts in the European Union, United Kingdom, or Japan, or that have a business phone number with a country calling code from any of those countries or regions, are not supported.
- Data is returned with a daily granularity in the UTC zone with a lookback of up to 90 days.
Prerequisites
- Before you get started, Create an API Key. To view the API Key and the SID, see View API Key and SID.
A prerequisite for using Kaleyra WhatsApp APIs is to have an active WhatsApp plan on Kaleyra platform. - To set up a WhatsApp account on Kaleyra platform, see Manual Signup
and Embedded Signup. - An active WhatsApp for Business API plan that includes:
- A WhatsApp business number.
- An associated profile with the business number.
- A WhatsApp verified and approved profile.
- A WABA ID onboarded on Kaleyra WhatsApp API V2.
API Domain and Value
| api_domain | Value |
|---|---|
| IN pod | api.in.kaleyra.io |
| SG Pod | api.ap.kaleyra.io |
| EU Pod | api.eu.kaleyra.io |
| NA pod | api.na.kaleyra.io |
API request to get Template Analytics
To get a list of all the WhatsApp templates analytics associated with a WABA ID, use the <api_domain>/v2/<sid>/whatsapp/<waba_id>/templates_analytics endpoint followed by query parameters as needed.
The following is the request format to get the WhatsApp templates analytics:
curl --location --request GET 'https://<api_domain>/v2/<sid>/whatsapp/<waba_id>/templates_analytics?whatsapp_template_ids=<whatsapp_template_ids>&start_date=<start_date>&end_date=<end_date>&granularity=<granularity>&product_type=<product_type>&metric_types=<metric_types>&limit=<limit>&after=<after>' \
-header 'api-key: <api-key>'
-header 'Content-Type: <content-type>'The following is the sample request format to get the WhatsApp template analytics:
curl --location --request GET 'https://api.in.kaleyra.io/v2/HXAP16XXXXXX97IN/whatsapp/1090XXXXXXXXXXXX/templates_analytics?whatsapp_template_ids=1317XXXXXXXXXX67,156XXXXXXXXXX011&start_date=2025-11-04&end_date=2025-11-05&granularity=daily&product_type=CLOUD_API&metric_types=sent&limit=1&after=MAZDZD' \
-header 'api-key: AXXXXXXXXXXXXXXXXXXXXX3' \
-header 'Content-Type: application/json'URL Parameters and Headers
The following is the list of parameters and headers to send the outgoing message request:
| Parameter / Headers | Data Type | Description | Example | Mandatory? |
|---|---|---|---|---|
sid | String | Account SID (Security Identifier). | HXAP16XXXXXX97IN | Yes |
waba_id | String | WhatsApp Business Account. For more information, see step 1 to step 3 of Adding a new WABA ID. | 1090XXXXXXXXXXXX | Yes |
Content-Type | String | Indicates the format of the content the API will be processing. | The only allowed value is application/json. | Yes |
api-key | String | API key generated from kaleyra.io account. | AXXXXXXXXXXXXXXXXXXXXX3 | Yes |
Following is the list of query parameters available to further specify the request:
Parameter / Headers | Data Type | Description | Example | Mandatory? |
|---|---|---|---|---|
| String | An array of template IDs for which you want to retrieve analytics details. | 1317XXXXXXXXXX67,156XXXXXXXXXX011 | Yes |
| Date string | The start date range for which you want to retrieve analytics details. A date string in the format YYYY-MM-DD. | 2025-08-21 | Yes |
| Date String | The end date specifying the range up to which analytics details are retrieved. A date string in the format YYYY-MM-DD. | 2025-08-21 | Yes |
| String | The granularity at which you would like to retrieve the analytics. Value must be DAILY. | DAILY | Yes |
| String | The product type of the metrics you want to retrieve. If omitted, only analytics for Cloud API will be returned.
| CLOUD_API | Optional |
| String | The types of metrics which you want to retrieve. If omitted or an empty array, analytics for all metric types will be returned. | SENT, DELIVERED, READ, CLICKED, REPLIED | Optional |
| Integer | The number of templates analytic details shown in the GET response. | 1 | Optional |
|
Sample Success Response
The following success message appears with the status 200 Accepted:
{
"code": "WA200",
"message": "Request successfully executed!",
"data": [
{
"granularity": "DAILY",
"product_type": "cloud_api",
"data_points": [
{
"template_id": "1317XXXXXXXXXX67",
"start": 1751328000,
"end": 1751414400,
"sent": 6,
"delivered": 6,
"read": 6,
"replied": 0,
"clicked": [
{
"type": "quick_reply_button",
"button_content": "Contact Support",
"count": 6
},
{
"type": "unique_url_button",
"button_content": "Tell me more",
"count": 5
}
]
},
{
"template_id": "156XXXXXXXXXX011",
"start": 1751414400,
"end": 1751500800,
"sent": 0,
"delivered": 0,
"read": 0,
"replied": 0
}
],
"paging": {
"cursors": {
"before": "",
"after": ""
}
}
"error": {}
}Response Parameters
The following is the list of parameters shown in the API response:
| Parameter | Data Type | Description | Example |
|---|---|---|---|
code | String | The response code for the request was sent. | WA200 |
message | String | The response message corresponds to the response code. | Request Processed Successfully. |
data | Object | Array of the objects returned by the API response with details of the WhatsApp template analytics for data. | See the specific table below for details. |
paging | Object | Array of the objects returned by the API response with details of the WhatsApp template analytics for paging. | See the specific table below for details. |
error | Array | The error list associated with the response. |
Data object Parameters
The following is the list of parameters for Data object in the API response:
| Parameter | Data Type | Description | Example |
|---|---|---|---|
granularity | String | The granularity at which you have retrieve the analytics. | DAILY |
product_type | String | The product type of the metrics you have retrieve. | CLOUD_AP |
data_points | Object | Array of the objects returned by the API response with details of the WhatsApp template analytics for the data_points. | See the specific table below for details. |
The following is the list of parameters for data_points object in the API response:
| Parameter | Data Type | Description | Example |
|---|---|---|---|
template_id | String | An array of template ID for which you have requested to retrieve analytics details. | 1317XXXXXXXXXX67 |
start | Date string | The start date range from which you have requested to retrieve analytics details in UNIX timestamp. | 1751328000 |
end | Date String | The end date specifying the range up to which analytics details are retrieved in UNIX timestamp. | 1751414400 |
sent | String | The number of WhatsApp messages sent using the specific template ID. | 6 |
delivered | String | The number of WhatsApp messages delivered using the specific template ID. | 6 |
read | String | The number of WhatsApp messages read by recipients using the specific template ID. | 6 |
replied | String | The number of WhatsApp messages read by recipients using the specific template ID. | 0 |
clicked | Object | Array of the objects returned by the API response with details of the WhatsApp template analytics for the clicked object. | See the specific table below for details. |
The following is the list of parameters for clicked object in the API response:
| Parameter | Data Type | Description | Example |
|---|---|---|---|
type | String | Button type used in the WhatsApp template. | quick_reply_button |
button_content | String | Button connect in the WhatsApp template. | Contact Support |
count | String | Button count clicked used in the WhatsApp template. | 6 |
The following is the list of parameters for paging object in the API response:
| Parameter | Data Type | Description | Example |
|---|---|---|---|
cursors | Object | Array of the objects returned by the API response with details of the WhatsApp template analytics for the cursors. | See the specific table below for details. |
The following is the list of parameters for cursors object in the API response:
| Parameter | Data Type | Description | Example |
|---|---|---|---|
before | Integer | View the WhatsApp template analytics details from the previous page. Only function from or after the second page. | |
after | Integer | View the WhatsApp template analytics details from the next pages. |
Sample Failure Response
The following are the failure responses:
400 Bad request
{
"code": "WA400",
"message": "error returned from meta",
"data": {},
"error": {
"error": "Template Insights are not available yet for this WhatsApp Business account.",
}
}401 Unauthorized
{
"code": "RBC001",
"message": "Incorrect SID or API key.",
"data": [],
"error": {
"error": "Incorrect SID or API key."
}
}401 Wrong account
{
"code": "WA-401",
"message": "API is not available for given customer.Please contact support for more info",
"data": {},
"error": "API is not available for given customer.Please contact support for more info"
}
401 Unauthorized WABA
{
"code": "WA401",
"message": "Waba_Id is not present or does not belong to the account.",
"data": {},
"error": {
"waba_id": "Waba_Id is not present or does not belong to the account."
}
}401 Unauthorized WABA version
{
"code": "WA401",
"message": "The waba_id you're using is associated with different Version of our WA API. Please use the appropriate endpoint.",
"data": {},
"error": {
"waba_id": "The waba_id you're using is associated with different Version of our WA API. Please use the appropriate endpoint."
}
}400 Invalid Status
{
"code": "WA400",
"message": "invalid status given. valid values are : accepted, pending, rejected, paused, disabled",
"data": [],
"error": {
"status": "invalid status given. valid values are : accepted, pending, rejected, paused, disabled"
}
}400 Invalid Status
{
"code": "WA400",
"message": "invalid status given. valid values are : accepted, pending, rejected, paused, disabled",
"data": [],
"error": {
"status": "invalid status given. valid values are : accepted, pending, rejected, paused, disabled"
}
}500 Internal Server Error
{
"code": "WA-500",
"message": "Please try again later",
"data": {},
"error": {
"error": "Internal server error"
}
}Updated about 2 hours ago
