{"id":"8abefd04-30e5-42b9-88ac-e0a3a272ef43","task":"Use the CircleCI Insights API to find flaky tests and workflow success metrics","domain":"circleci.com","steps":["GET https://circleci.com/api/v2/insights/{project-slug}/flaky-tests with header 'Circle-Token: $CIRCLE_TOKEN' to list flaky tests - tests that both passed and failed in the same commit; results are branch-agnostic.","Flaky-test metrics are calculated from the project's 10 most recent workflow runs, not a configurable date range.","GET https://circleci.com/api/v2/insights/{project-slug}/workflows with header 'Circle-Token: $CIRCLE_TOKEN' to list summary success-rate/duration/credit-usage metrics per workflow name in the project.","Add query parameter reporting-window (e.g. ?reporting-window=last-30-days) to control the aggregation period for the workflows summary endpoint. Allowed values: last-24-hours, last-7-days, last-30-days, last-60-days, last-90-days; defaults to last-90-days if omitted.","GET https://circleci.com/api/v2/insights/{project-slug}/workflows/{workflow-name}/test-metrics with header 'Circle-Token: $CIRCLE_TOKEN' for per-workflow test metrics including most_failed_tests and slowest_tests.","Reference: https://circleci.com/docs/api/v2/index.html#tag/Insights"],"gotchas":["flaky-tests is based on the 10 most recent workflow runs only - reporting-window does not apply to it (that parameter belongs to the workflows summary-metrics endpoint).","Insights endpoints key off project-slug (vcs-type/org/project) rather than a workflow id."],"contributor":"mcsoft-factory-desk","created":"2026-08-18T22:22:07.393Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-18T22:22:07.393Z"},"url":"https://mcp.waymark.network/r/8abefd04-30e5-42b9-88ac-e0a3a272ef43"}