Reference
Analytics
Flexible analytics queries for aggregating call data across templates, merchants, and time ranges.
Overview
The analytics API provides a unified query interface for aggregating call data. All queries are submitted via a single endpoint with a structured query body supporting filtering, pagination, and time granularity.
Query endpoint
POST
/analytics Supported Query Types
| Query Type | Description |
|---|---|
call_count | Total number of calls matching filters. |
call_duration | Aggregate duration statistics (avg, min, max, total). |
outcome_distribution | Breakdown of call outcomes. |
sentiment_distribution | Sentiment score distribution. |
status_distribution | Lead status breakdown. |
calls_over_time | Call count grouped by time granularity. |
avg_duration_over_time | Average duration grouped by time granularity. |
top_outcomes | Most frequent outcomes ranked by count. |
retry_analysis | Retry attempt distribution and success rates. |
provider_breakdown | Call volume by telephony provider. |
hourly_heatmap | Call distribution by hour of day. |
conversion_funnel | Lead progression through statuses. |
Filter Options
| Filter | Type | Description |
|---|---|---|
template_id | string | Filter by template. |
merchant_id | string | Filter by merchant. |
reseller_id | string | Filter by reseller. |
date_from | string (ISO 8601) | Start of date range. |
date_to | string (ISO 8601) | End of date range. |
min_duration | int | Minimum call duration in seconds. |
max_duration | int | Maximum call duration in seconds. |
sentiment_min | float | Minimum sentiment score (0.0–1.0). |
sentiment_max | float | Maximum sentiment score (0.0–1.0). |
payload_filters | object | Filter on arbitrary payload fields (e.g. {"city": "Mumbai"}). |
Example Query
json
{
"query_type": "calls_over_time",
"filters": {
"template_id": "tpl_xyz789",
"merchant_id": "mer_abc",
"date_from": "2025-01-01T00:00:00Z",
"date_to": "2025-01-31T23:59:59Z",
"min_duration": 10
},
"granularity": "day",
"page": 1,
"page_size": 31
}Example Response
json
{
"query_type": "calls_over_time",
"data": [
{ "date": "2025-01-01", "count": 42 },
{ "date": "2025-01-02", "count": 58 },
{ "date": "2025-01-03", "count": 37 }
],
"total": 31,
"page": 1,
"page_size": 31
}Payload Filters
Use payload_filters to query on custom fields from your lead payloads. For example, filter by city, plan type, or any key-value pair you include when pushing leads.
Error responses
| Status | Meaning | Common Cause |
|---|---|---|
400 | Bad Request | Invalid query type or malformed filters. |
422 | Unprocessable Entity | Invalid date range or filter values. |
Was this helpful?