Analytics API
Endpoints for metrics, reports, and data export.
Overview Metrics
GET
/api/analytics/overviewAuth: SessionGet overview KPI metrics.
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
period | string | Required | "today", "yesterday", "7d", "30d", or "90d" |
Response (200):
json
{ "metrics": { "serviceLevel": { "value": 82.5, "target": 80, "unit": "%" }, "averageHandleTime": { "value": 185, "target": 300, "unit": "seconds", "formatted": "3:05" }, "averageSpeedOfAnswer": { "value": 18, "target": 20, "unit": "seconds" }, "occupancy": { "value": 78.2, "target": 85, "unit": "%" }, "adherence": { "value": 91.5, "target": 90, "unit": "%" }, "contactVolume": { "offered": 1250, "handled": 1180, "abandoned": 70, "abandonRate": 5.6 } }, "period": "7d", "dateRange": { "startDate": "2026-01-22", "endDate": "2026-01-29" }}Service Level
GET
/api/analytics/service-levelAuth: SessionGet service level trends.
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
period | string | Required | Time period (7d, 30d, etc.) |
groupBy | string | Optional | "day" or "hour" |
Response (200):
json
{ "trends": [ { "label": "2026-01-22", "serviceLevel": 85.2, "aht": 180, "asa": 15, "occupancy": 78.5, "contacts": 180, "abandoned": 8, "abandonRate": 4.4 }, { "label": "2026-01-23", "serviceLevel": 82.1, "aht": 195, "asa": 22, "occupancy": 81.2, "contacts": 210, "abandoned": 12, "abandonRate": 5.7 } ], "average": { "serviceLevel": 83.4, "aht": 188, "asa": 18 }}Agent Performance
GET
/api/analytics/agent-performanceAuth: SessionGet agent performance scorecards.
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
period | string | Required | Time period |
sortBy | string | Optional | "adherence", "occupancy", "hours", "name" |
teamId | string | Optional | Filter by team |
Response (200):
json
{ "agents": [ { "id": "uuid", "name": "John Doe", "employeeNumber": "EMP001", "teamName": "Sales", "metrics": { "adherence": 92.5, "occupancy": 78.3, "hoursWorked": 38.5, "shiftsWorked": 5, "contactsHandled": 245, "avgHandleTime": 175, "productiveTime": { "onCall": 1200, "acw": 180, "available": 420, "break": 60 } } } ], "teamAverages": { "adherence": 89.5, "occupancy": 76.2, "totalHours": 385 }}Forecast Accuracy
GET
/api/analytics/forecast-accuracyAuth: SessionCompare forecast to actual results.
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
forecastId | string | Optional | Specific forecast to analyze |
startDate | string | Optional | Start date (YYYY-MM-DD) |
endDate | string | Optional | End date (YYYY-MM-DD) |
Response (200):
json
{ "accuracy": { "overall": 94.2, "volume": 95.1, "aht": 93.3 }, "comparison": [ { "date": "2026-01-22", "interval": "08:00", "forecasted": { "volume": 45, "aht": 180 }, "actual": { "volume": 42, "aht": 175 }, "variance": { "volume": -6.7, "aht": -2.8 } } ]}Data Export
POST
/api/analytics/exportAuth: SessionExport analytics data.
Request Body:
json
{ "format": "csv", "type": "service-level", "startDate": "2026-01-01", "endDate": "2026-01-31", "metrics": ["serviceLevel", "aht", "volume"]}| Parameter | Type | Required | Description |
|---|---|---|---|
format | string | Required | "csv" or "json" |
type | string | Required | "service-level", "agent-performance", "adherence", "contact-volume" |
startDate | string | Required | Start date |
endDate | string | Required | End date |
metrics | array | Optional | Specific metrics to include |
Response (200):
Returns file download (CSV) or JSON data based on format.