Skip to main content
GET
/
api
/
v2
/
analytics
/
test-cases
Test-case analytics
curl --request GET \
  --url https://api.empirical.run/api/v2/analytics/test-cases \
  --header 'Authorization: Bearer <token>'
{
  "data": {
    "test_cases": [
      {
        "test_case_id": "<string>",
        "test_name": "<string>",
        "file_path": "<string>",
        "project_name": "<string>",
        "tags": [
          "<string>"
        ],
        "last_run_at": "<string>",
        "metrics": {
          "total_runs": 123,
          "pass_count": 123,
          "fail_count": 123,
          "flaky_count": 123,
          "pass_rate": 123,
          "fail_rate": 123,
          "flaky_rate": 123
        }
      }
    ],
    "summary": {
      "total_test_cases": 123,
      "test_cases_with_history": 123
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

days
integer

Number of days to include (1-90). Ignored when both start_date and end_date are provided.

Required range: 1 <= x <= 90
start_date
string

Start of a custom date range (ISO 8601).

end_date
string

End of a custom date range (ISO 8601).

environment_id
string

Filter to a single environment by ID.

Free-text search over test name and file path.

tags
string

Comma-separated list of tags to filter by.

order_by
enum<string>

Field to order results by. One of fail_rate, flaky_rate, last_run. Defaults to fail_rate.

Available options:
fail_rate,
flaky_rate,
last_run
order
enum<string>

Sort direction, asc or desc. Defaults to desc.

Available options:
asc,
desc
limit
integer

Maximum number of test cases to return (1-500).

Required range: 1 <= x <= 500
limit_history
integer

Maximum number of history entries to return per test case (1-100).

Required range: 1 <= x <= 100
test_case_id
string

Filter to a single test case by ID.

is_active
enum<string>

When false, include inactive test cases. Defaults to active-only.

Available options:
true,
false

Response

Test cases with metrics.

data
object
required

Response payload.