Calls by Phone Number
Overview
Returns call count and duration metrics grouped by platform number bucket. Optionally filter by a specific assistant.
Endpoint
- URL:
/analytics/calls/by-phone-number
- Method:
GET
- Authentication: Required
Request
Query Parameters
| Parameter |
Type |
Required |
Default |
Description |
start_date |
datetime |
No |
30 days ago |
ISO 8601 start of range. |
end_date |
datetime |
No |
Now |
ISO 8601 end of range. |
assistant_id |
string |
No |
-- |
Filter by a specific assistant. |
Response Schema
| Field |
Type |
Description |
success |
boolean |
Operation status. |
message |
string |
Result message. |
data.phone_numbers |
array |
List of per-platform-bucket metrics. |
data.phone_numbers[].phone_number |
string |
Platform bucket label (WEB_CALL, UNKNOWN_PLATFORM, or a platform number). |
data.phone_numbers[].total_calls |
integer |
Total calls to this number. |
data.phone_numbers[].total_duration_minutes |
float |
Total duration in minutes. |
data.phone_numbers[].total_duration_hours |
float |
Total duration in hours. |
data.phone_numbers[].avg_duration_minutes |
float |
Average call duration in minutes. |
HTTP Status Codes
| Code |
Description |
| 200 |
Data returned successfully. |
| 401 |
Unauthorized (invalid or missing API key). |
| 500 |
Internal server error. |
Example Request
curl -X GET "https://api-livekit-vyom.indusnettechnologies.com/analytics/calls/by-phone-number?assistant_id=550e8400-e29b-41d4-a716-446655440000" \
-H "Authorization: Bearer YOUR_API_KEY"
Example Response
{
"success": true,
"message": "Calls by phone number fetched successfully",
"data": {
"phone_numbers": [
{
"phone_number": "+919876543210",
"total_calls": 15,
"total_duration_minutes": 67.50,
"total_duration_hours": 1.13,
"avg_duration_minutes": 4.50
},
{
"phone_number": "+918765432109",
"total_calls": 8,
"total_duration_minutes": 32.20,
"total_duration_hours": 0.54,
"avg_duration_minutes": 4.03
}
]
}
}
Notes
- Results are sorted by total duration in descending order.
- The
phone_number field is a platform bucket: WEB_CALL for web sessions, UNKNOWN_PLATFORM for non-web records missing platform_number, otherwise the platform_number value.
avg_duration_minutes is calculated as total_duration_minutes / total_calls (derived from totals, not raw Mongo $avg), and returns 0 when total_calls is 0. Duration values are rounded to two decimal places.