Test Result Statistics API
GET /test_results/stats aggregates test results for dashboards and reporting: per-metric and overall pass/fail rates, dimensional breakdowns, and timelines. It reads from the v_test_result_stats view, using the stored test result status (with human-review overrides applied) as the source of truth — see Test Result Status.
All requests require a bearer token:
Modes
The mode parameter selects which sections the response includes; every response also carries metadata. Use the narrowest mode for the job to keep payloads small.
| Mode | Sections (besides metadata) |
|---|---|
summary | overall_pass_rates |
overall | overall_pass_rates |
metrics | metric_pass_rates |
behavior | behavior_pass_rates |
category | category_pass_rates |
topic | topic_pass_rates |
timeline | timeline |
test_runs | test_run_summary |
all | all of the above (default when mode is omitted) |
Filters
All UUID and tag filters accept multiple values via repeated parameters (e.g. ?behavior_ids=uuid1&behavior_ids=uuid2); results match any of the given IDs. tags uses AND logic (a test must carry all listed tags).
| Parameter | Type | Description |
|---|---|---|
test_set_ids | UUID[] | Filter by test sets |
test_ids | UUID[] | Filter by specific tests |
test_type_ids | UUID[] | Filter by test types |
behavior_ids | UUID[] | Filter by behaviors |
category_ids | UUID[] | Filter by categories |
topic_ids | UUID[] | Filter by topics |
status_ids | UUID[] | Filter by test statuses |
prompt_ids | UUID[] | Filter by prompts |
test_run_ids | UUID[] | Filter by test runs (test_run_id also accepted for a single run) |
user_ids | UUID[] | Filter by test creators |
assignee_ids | UUID[] | Filter by assignees |
owner_ids | UUID[] | Filter by owners |
tags | string[] | Filter by tags (AND logic) |
priority_min / priority_max | int | Priority range (inclusive) |
start_date / end_date | ISO date | Explicit date range (overrides months) |
months | int | Historical window, default 6 |
Response shape
Each *_pass_rates block reports total, passed, failed, and pass_rate (percentage). metric_pass_rates, behavior_pass_rates, category_pass_rates, and topic_pass_rates key those blocks by name.