---
title: "Retrieve flaky and total test counts for a workspace, broken down by test type"
method: POST
path: "/workspaces/{workspace_id}/reports/flakyTestCounts"
tags: ["Report"]
---

# Retrieve flaky and total test counts for a workspace, broken down by test type

`POST /workspaces/{workspace_id}/reports/flakyTestCounts`

Returns workspace-wide test counts and flaky-test counts, both overall and broken down
by test type, over a specified time range. A test is flaky when its flake_rate is 0.10
or higher (equivalently, stability_rate is 0.90 or lower) -- the same definition and
threshold as testQuality's tests_above_flakiness_threshold summary field.

Unlike testQuality, this endpoint returns only aggregate counts, not per-test rows --
use it when a caller needs workspace-wide totals without paginating through every test.

POST + a request body (rather than query params, like the rest of this file's query*
endpoints) because plan_labels is an unbounded array -- as a CSV query param it can grow
the URL past what a client, proxy, or load balancer will send.

## Path parameters

- `workspace_id` string, required

## Request body

- FlakyTestReportRequest — Filter and time-range parameters for queryFlakyTestCounts
  - `start_time` integer, required — Start of the query time range in epoch milliseconds
  - `end_time` integer, required — End of the query time range in epoch milliseconds
  - `application_id` string — Optional application ID to filter by
  - `plan_id` string — Optional plan ID to filter by
  - `environment_id` string — Optional environment ID to filter by
  - `test_type` 'api' | 'browser' | 'performance' | 'mobile' — Type of test
  - `browser` 'chrome' | 'edge' | 'firefox' | 'internet_explorer' | 'safari' | 'webkit' — The browser used to execute a test
  - `execution_source` 'mabl_cloud' | 'external' | 'mabl_local' | 'mabl_agent' — Where the test lives
  - `plan_labels` string[] — Plan labels to filter by (tests must belong to plans with these labels)
  - `min_plan_runs` integer — Minimum number of plan runs required for a test to be included

## Response `200`

Flaky and total test counts for the specified time range

- FlakyTestCounts — Total and flaky test counts, either workspace-wide or for a single test type
  - `total` integer — Total number of tests matching the filters
  - `flaky` integer — Number of tests with flake_rate >= 0.10 (stability_rate <= 0.90) -- same definition as testQuality's tests_above_flakiness_threshold summary field
  - `by_type` object
    - `browser` TestTypeCounts — Total and flaky test counts, either workspace-wide or for a single test type
      - `total` integer — Total number of tests matching the filters
      - `flaky` integer — Number of tests with flake_rate >= 0.10 (stability_rate <= 0.90) -- same definition as testQuality's tests_above_flakiness_threshold summary field
    - `mobile` TestTypeCounts — Total and flaky test counts, either workspace-wide or for a single test type
      - `total` integer — Total number of tests matching the filters
      - `flaky` integer — Number of tests with flake_rate >= 0.10 (stability_rate <= 0.90) -- same definition as testQuality's tests_above_flakiness_threshold summary field
    - `api` TestTypeCounts — Total and flaky test counts, either workspace-wide or for a single test type
      - `total` integer — Total number of tests matching the filters
      - `flaky` integer — Number of tests with flake_rate >= 0.10 (stability_rate <= 0.90) -- same definition as testQuality's tests_above_flakiness_threshold summary field
    - `performance` TestTypeCounts — Total and flaky test counts, either workspace-wide or for a single test type
      - `total` integer — Total number of tests matching the filters
      - `flaky` integer — Number of tests with flake_rate >= 0.10 (stability_rate <= 0.90) -- same definition as testQuality's tests_above_flakiness_threshold summary field

## Other responses

- `400` — Invalid or missing parameter
- `401` — User not authenticated
- `403` — User not authorized
- `default` — Unexpected error

---

[API](https://skmtc.dev/mabl/apis/mabl-api.md) · [All operations](https://skmtc.dev/mabl/apis/mabl-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/mabl/mabl-api/revisions/213a66c2bc25/schema)
