Scenario Statistics
Retrieve aggregate statistics across all scenarios in the workspace.
Scenario Statistics
Returns workspace-level metrics for scenarios including total counts, simulation volume, average scores, and breakdowns by status and tag.
Endpoint
GET /api/v1/scenarios/stats
curl -X GET "https://api.chanl.ai/api/v1/scenarios/stats?period=30d" \
-H "Authorization: Bearer <access_token>"const response = await fetch('https://api.chanl.ai/api/v1/scenarios/stats?period=30d', {
method: 'GET',
headers: {
'Authorization': `Bearer ${accessToken}`,
},
});
const data = await response.json();import requests
response = requests.get(
'https://api.chanl.ai/api/v1/scenarios/stats',
headers={'Authorization': f'Bearer {access_token}'},
params={'period': '30d'},
)
data = response.json()Query Parameters
periodstringdefault: 30dTime window for statistics. One of 7d, 30d, 90d.
Response
Response
{
"success": true,
"data": {
"stats": {
"overview": {
"total_scenarios": 25,
"active_scenarios": 18,
"draft_scenarios": 4,
"archived_scenarios": 3
},
"simulations": {
"total": 1450,
"period_total": 378,
"avg_score": 84.2,
"pass_rate": 91.7
},
"most_used_scenario": {
"id": "scenario_abc123",
"name": "Billing Dispute Resolution",
"simulation_count": 156
},
"best_performing_scenario": {
"id": "scenario_def456",
"name": "Simple FAQ Check",
"avg_score": 96.1,
"simulation_count": 89
},
"worst_performing_scenario": {
"id": "scenario_ghi789",
"name": "Hostile Escalation Test",
"avg_score": 62.4,
"simulation_count": 45
},
"by_tag": {
"billing": {
"count": 6,
"avg_score": 81.3,
"total_simulations": 412
},
"support": {
"count": 10,
"avg_score": 86.9,
"total_simulations": 678
}
},
"trends": {
"last_7_days": {
"simulations": 89,
"avg_score": 85.2
},
"last_30_days": {
"simulations": 378,
"avg_score": 84.2
}
}
}
}
}Errors
| Status | Code | Description |
|---|---|---|
| 400 | validation_error | Invalid period value |
| 401 | unauthorized | Missing or invalid access token |