Flaky tests API

To retrieve flaky tests using the API, use the list tests endpoint with the label=flaky query parameter:

curl -H "Authorization: Bearer $TOKEN" \
  -X GET "https://api.buildkite.com/v2/analytics/organizations/{org.slug}/suites/{suite.slug}/tests?label=flaky"

Required scope: read_suites

Success response: 200 OK

Legacy flaky tests endpoint (deprecated)

This endpoint is deprecated

Use the list tests endpoint with ?label=flaky instead.

The legacy flaky tests endpoint is still available but no longer recommended. It does not return the same data as the Buildkite Test Engine UI.

curl -H "Authorization: Bearer $TOKEN" \
  -X GET "https://api.buildkite.com/v2/analytics/organizations/{org.slug}/suites/{suite.slug}/flaky-tests"
[
  {
    "id": "01867216-8478-7fde-a55a-0300f88bb49b",
    "web_url": "https://buildkite.com/organizations/my_great_org/analytics/suites/my_suite_name/tests/01867216-8478-7fde-a55a-0300f88bb49b",
    "scope": "User#email",
    "name": "is correctly formatted",
    "location": "./spec/models/user_spec.rb:42",
    "file_name": "./spec/models/user_spec.rb",
    "instances": 1,
    "latest_occurrence_at": "2024-07-15T00:07:02.547Z",
    "most_recent_instance_at": "2024-07-15T00:07:02.547Z",
    "last_resolved_at": null,
    "ownership_team_ids": ["4c15a4c7-6674-4585-b592-4adcc8630383", "d30fd7ba-82d8-487f-9d98-6e1a057bcca8"]
  }
]

Optional query string parameters:

search Returns flaky tests with a name or scope that contains the search string. Users with the Ruby test collector installed can also filter results by location.

Example: ?search="User#find_email", ?search="/billing_spec"

branch Returns flaky tests for flakes detected one or more times on the branch whose name is specified by the branch value.

Example: ?branch=main

period Filters the results by the given time period. Valid values are 1hour, 4hours, 1day, 7days, 14days, and 28days. The default period when no period value is specified is 7days.

Example: ?period=28days

Required scope: read_suites

Success response: 200 OK