WhatsApp Template Analytics & Pricing API
The Messaging API provides read-only analytics endpoints (read-only) to pull WhatsApp template performance metrics (delivery counts and button clicks) as well as paid message volume (pricing analytics) directly into your data warehouse or internal dashboards.
When you need this
Section titled “When you need this”- You want to pull daily data on delivery counts (
sent,delivered,read) and button clicks for one or hundreds of WhatsApp templates at once. - You want to group the performance of language/rotation template variants by the template’s base name (
group_by=base_template). - You want to pull WhatsApp message volume billed per hour, day, or month through an endpoint compatible with the structure
pricing_analyticsMeta.
Retrieve template analytics and pricing via API
Section titled “Retrieve template analytics and pricing via API”- Prepare your active API Key from the Developer › API Keys menu and include it in the
Authorization: Bearer <API_KEY>header orX-API-Key: <API_KEY>. - To retrieve performance metrics for up to 100 templates via URL parameters, call
GET /v1/template_analytics(orGET /v1/{waba_id}/template_analyticsto limit to a single WABA):Terminal window curl -G "https://messaging.cpaas.id/v1/template_analytics" \-H "Authorization: Bearer $MHD_API_KEY" \--data-urlencode "start=1760054400" \--data-urlencode "end=1760659200" \--data-urlencode "granularity=DAILY" \--data-urlencode "tz=Asia/Jakarta" \--data-urlencode "template_names=promo_akhir_pekan,notifikasi_tagihan" - If you want to pull analytics for up to 500 templates at once without hitting URL length limits, use the batch endpoint
POST /v1/template_analytics/query:Terminal window curl -X POST "https://messaging.cpaas.id/v1/template_analytics/query" \-H "Authorization: Bearer $MHD_API_KEY" \-H "Content-Type: application/json" \-d '{"start": 1760054400,"end": 1760659200,"granularity": "DAILY","tz": "Asia/Jakarta","base_template_names": ["promo_akhir_pekan"],"group_by": "base_template"}' - To pull paid message volume from your account ledger, call
GET /v1/pricing_analytics(orGET /v1/{phone_number_id}/pricing_analyticsfor a single phone number):Terminal window curl -G "https://messaging.cpaas.id/v1/pricing_analytics" \-H "Authorization: Bearer $MHD_API_KEY" \--data-urlencode "start=1760054400" \--data-urlencode "end=1760659200" \--data-urlencode "granularity=DAILY" \--data-urlencode "timezone=Asia/Jakarta"
Analytics Endpoint & Parameter Reference
Section titled “Analytics Endpoint & Parameter Reference”| Endpoint | Method | Key Limits & Behavior |
|---|---|---|
/v1/template_analytics | GET | Retrieves template delivery metrics (attributed to the send day in the timezone of tz, default UTC) and button click metrics. Supports filtering template_ids, template_names, or base_template_names up to 100 items, as well as group_by=base_template. |
/v1/{waba_id}/template_analytics | GET | Same as /v1/template_analytics, but scoped to a single WABA (internal UUID or Meta WABA ID). Returns 403 if the WABA does not belong to your API Key account. |
/v1/template_analytics/query | POST | Batch queries using a JSON body that supports up to 500 template_ids, template_names, or base_template_names. |
/v1/pricing_analytics | GET | Reports paid WhatsApp message volume (pricing_type = REGULAR) from the account’s financial ledger. Default timezone Asia/Jakarta (WIB). Supported granularity: HOURLY (max. 7 days), DAILY (max. 90 days), and MONTHLY (max. 12 months). Granularity HALF_HOUR is not supported and returns 400. |
/v1/{phone_number_id}/pricing_analytics | GET | Same as /v1/pricing_analytics, but limited to one phone_number_id Meta. |