Call Metrics
The Call Metrics API provides analytics and performance data for your organization’s and individual provider’s calls.
Endpoints
List Call Metrics
Retrieve call metrics for your organization with optional filtering by date range and user.
GET /api/external/call_metrics
Parameters
Parameter | Type | Location | Required | Description |
---|---|---|---|---|
date_start | string | query | No | Start date in YYYY-MM-DD format |
date_end | string | query | No | End date in YYYY-MM-DD format |
user_id | string | query | No | Optional User ID to filter metrics. If not provided, metrics for the entire organization are returned |
Example Request
curl -X GET "https://api.kismethealth.com/api/external/call_metrics?date_start=2025-07-01&date_end=2025-07-31&user_id=123" \
-H "X-Client-ID: your-client-id" \
-H "X-Client-Secret: your-client-secret" \
-H "Content-Type: application/json"
Example Response
{
"total_calls": {
"2025-07-17": 5,
"2025-07-16": 8,
"2025-07-15": 3
},
"average_duration": {
"2025-07-17": 300.000197,
"2025-07-16": 425.123456,
"2025-07-15": 180.987654
},
"call_fail_rate": {
"2025-07-17": 0.0,
"2025-07-16": 1.0,
"2025-07-15": 0.0
},
"average_wait_time": {
"2025-07-17": 3.2,
"2025-07-16": 5.7,
"2025-07-15": 2.1
}
}
Metrics Explained
Total Calls
The number of calls that occurred on each date.
Data Type: Object with date keys and integer values
Example: "2025-07-17": 5
means 5 calls occurred on July 17, 2025
Average Duration
The average duration of calls in seconds for each date.
Data Type: Object with date keys and decimal values
Example: "2025-07-17": 300.000197
means the average call duration on July 17, 2025 was approximately 5 minutes
Call Fail Rate
The percentage of calls that failed on each date, represented as a decimal between 0 and 100.
Data Type: Object with date keys and decimal values
Example: "2025-07-17": 0.125
means 12.5% of calls failed on July 17, 2025
Average Wait Time
The average time users waited before their call started, in seconds.
Data Type: Object with date keys and decimal values
Example: "2025-07-17": 3.2
means users waited an average of 3.2 seconds before their call started
Filtering Options
Date Range Filtering
You can filter metrics by specifying a date range:
# Get metrics for the last 30 days
curl -X GET "https://api.kismethealth.com/api/external/call_metrics?date_start=2025-06-18&date_end=2025-07-18" \
-H "X-Client-ID: your-client-id" \
-H "X-Client-Secret: your-client-secret"
User-Specific Metrics
To get metrics for a specific user instead of the entire organization:
# Get metrics for user ID 123
curl -X GET "https://api.kismethealth.com/api/external/call_metrics?user_id=123" \
-H "X-Client-ID: your-client-id" \
-H "X-Client-Secret: your-client-secret"
Combined Filtering
You can combine date range and user filtering:
# Get metrics for user 123 in July 2025
curl -X GET "https://api.kismethealth.com/api/external/call_metrics?date_start=2025-07-01&date_end=2025-07-31&user_id=123" \
-H "X-Client-ID: your-client-id" \
-H "X-Client-Secret: your-client-secret"
Code Examples
JavaScript/Node.js
const getCallMetrics = async (options = {}) => {
const { dateStart, dateEnd, userId } = options;
const params = new URLSearchParams();
if (dateStart) params.append('date_start', dateStart);
if (dateEnd) params.append('date_end', dateEnd);
if (userId) params.append('user_id', userId);
const url = `https://api.kismethealth.com/api/external/call_metrics${params.toString() ? '?' + params.toString() : ''}`;
const response = await fetch(url, {
headers: {
'X-Client-ID': process.env.KISMET_CLIENT_ID,
'X-Client-Secret': process.env.KISMET_CLIENT_SECRET,
'Content-Type': 'application/json'
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.json();
};
// Usage examples
const allMetrics = await getCallMetrics();
const userMetrics = await getCallMetrics({ userId: '123' });
const dateRangeMetrics = await getCallMetrics({
dateStart: '2025-07-01',
dateEnd: '2025-07-31'
});
Python
import requests
from datetime import datetime, timedelta
def get_call_metrics(date_start=None, date_end=None, user_id=None):
params = {}
if date_start:
params['date_start'] = date_start
if date_end:
params['date_end'] = date_end
if user_id:
params['user_id'] = user_id
response = requests.get(
'https://api.kismethealth.com/api/external/call_metrics',
headers={
'X-Client-ID': 'your-client-id',
'X-Client-Secret': 'your-client-secret',
'Content-Type': 'application/json'
},
params=params
)
response.raise_for_status()
return response.json()
# Usage examples
all_metrics = get_call_metrics()
user_metrics = get_call_metrics(user_id='123')
date_range_metrics = get_call_metrics(
date_start='2025-07-01',
date_end='2025-07-31'
)
Common Use Cases
Dashboard Analytics
Use call metrics to build analytics dashboards showing:
- Call volume trends
- Performance metrics
- User-specific insights
- Failure rate monitoring
Performance Monitoring
Monitor key metrics to identify:
- High fail rates indicating system issues
- Long wait times affecting user experience
- Unusual call patterns
Reporting
Generate reports for:
- Monthly performance summaries
- User activity reports
- System health monitoring
- Capacity planning
Error Handling
400 Bad Request
{
"error": "Bad Request",
}
404 Not Found
{
"error": "Not Found",
}
Always validate date formats and handle errors appropriately in your application.