Template analytics batch query
const url = 'https://example.com/v1/template_analytics/query';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"base_template_names":["example"],"end":1,"granularity":"example","group_by":"example","include_inactive":true,"limit":1,"metric_types":["example"],"page":1,"product_type":"example","search":"example","sort_by":"example","sort_order":"example","start":1,"template_ids":["example"],"template_names":["example"],"tz":"example","waba_id":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/template_analytics/query \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "base_template_names": [ "example" ], "end": 1, "granularity": "example", "group_by": "example", "include_inactive": true, "limit": 1, "metric_types": [ "example" ], "page": 1, "product_type": "example", "search": "example", "sort_by": "example", "sort_order": "example", "start": 1, "template_ids": [ "example" ], "template_names": [ "example" ], "tz": "example", "waba_id": "example" }'Query WhatsApp template analytics with a JSON body supporting up to 500 template_ids, template_names, or base_template_names without URL length limits. Strictly read-only.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”object
false (default) returns only templates with activity in the range; true returns every template.
Example generated
{ "base_template_names": [ "example" ], "end": 1, "granularity": "example", "group_by": "example", "include_inactive": true, "limit": 1, "metric_types": [ "example" ], "page": 1, "product_type": "example", "search": "example", "sort_by": "example", "sort_order": "example", "start": 1, "template_ids": [ "example" ], "template_names": [ "example" ], "tz": "example", "waba_id": "example"}Responses
Section titled “ Responses ”Template analytics response
object
object
“event_day_utc” — clicked_total, unique_clicked_total, url_button_clicks, unique_url_button_clicks, quick_reply_button_clicks, unique_quick_reply_button_clicks, and clicked_breakdown are bucketed by the UTC calendar day (00:00–24:00 UTC) the click occurred.
“meta” (template_analytics_daily), “inbound_taps” (template_inbound_button_taps_daily), or “none”
“send_day” — sent_count, delivered_count, read_count, and failed_count count each
message’s current status on the calendar day (in tz) the message was sent/created.
“rows” (mahadata.messages_v3_by_client_day via traffic_rows) or “scylla_v3_counters”
Human-readable explanation of why a day bucket can show clicks/reads with 0 sends.
object
object
object
Example generated
{ "attribution": { "clicks_attribution": "example", "clicks_source": "example", "delivery_attribution": "example", "delivery_source": "example", "note": "example" }, "data": [ { "base_template_name": "example", "category": "example", "click_rate": 1, "clicked_breakdown": [ { "button_content": "example", "count": 1, "type": "example" } ], "clicked_total": 1, "clicks_attribution": "example", "clicks_source": "example", "delivered_count": 1, "delivery_attribution": "example", "delivery_rate": 1, "delivery_source": "example", "failed_count": 1, "language": "example", "meta_template_id": "example", "product_types": [ "example" ], "quick_reply_button_clicks": 1, "read_count": 1, "read_rate": 1, "sent_count": 1, "status": "example", "template_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "template_name": "example", "unique_click_rate": 1, "unique_clicked_total": 1, "unique_quick_reply_button_clicks": 1, "unique_url_button_clicks": 1, "url_button_clicks": 1, "variant_count": 1, "waba_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } ], "end": 1, "granularity": "example", "group_by": "example", "pagination": { "limit": 1, "page": 1, "total_items": 1, "total_pages": 1 }, "product_type": "example", "ready_days": 1, "start": 1, "status": "example", "template_analytics_enabled": true, "total_days": 1, "tz": "example"}Invalid request body
Standard error response format.
object
object
Example generated
{ "error": { "code": 1, "message": "example", "type": "example" }}Unauthorized - Invalid API Key
Standard error response format.
object
object
Example generated
{ "error": { "code": 1, "message": "example", "type": "example" }}Forbidden - WABA or template not owned by this API key
Standard error response format.
object
object
Example generated
{ "error": { "code": 1, "message": "example", "type": "example" }}Too many concurrent requests for this account
Standard error response format.
object
object
Example generated
{ "error": { "code": 1, "message": "example", "type": "example" }}Service busy
Standard error response format.
object
object
Example generated
{ "error": { "code": 1, "message": "example", "type": "example" }}