Analytics
Test-run analytics
Returns daily test-run statistics and a period summary for the scoped project.
GET
/
api
/
v2
/
analytics
/
test-runs
Test-run analytics
curl --request GET \
--url https://api.empirical.run/api/v2/analytics/test-runs \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.empirical.run/api/v2/analytics/test-runs"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.empirical.run/api/v2/analytics/test-runs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.empirical.run/api/v2/analytics/test-runs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.empirical.run/api/v2/analytics/test-runs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.empirical.run/api/v2/analytics/test-runs")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.empirical.run/api/v2/analytics/test-runs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"daily": [
{
"date": "<string>",
"run_count": 123,
"passed_runs": 123,
"failed_runs": 123,
"error_runs": 123,
"cancelled_runs": 123,
"rerun_count": 123,
"total_tests": 123,
"passed_tests": 123,
"failed_tests": 123,
"failed_tests_after_snooze": 123,
"flaky_tests": 123
}
],
"summary": {
"total_runs": 123,
"passed_runs": 123,
"failed_runs": 123,
"error_runs": 123,
"pass_rate": 123,
"avg_tests_per_run": 123,
"rerun_count": 123,
"rerun_rate": 123
}
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}Analytics uses path-based versioning; the current recommended version is v2 (
/api/v2/analytics/). The v1 endpoints (/api/v1/analytics/*) are deprecated but remain available for backward compatibility. In v2, the v1 test-cases endpoint is split: GET /api/v2/analytics/test-cases returns metrics only, and POST /api/v2/analytics/test-case-history/batch fetches history for one or many test cases in a single request.
Percentage fields (pass_rate, fail_rate, flaky_rate) are integers in the 0-100 range, not decimals. All endpoints support date filtering via days (1-90), or a custom start_date/end_date range (ISO 8601).Authorizations
Query Parameters
Was this page helpful?
Test-run analytics
curl --request GET \
--url https://api.empirical.run/api/v2/analytics/test-runs \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.empirical.run/api/v2/analytics/test-runs"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.empirical.run/api/v2/analytics/test-runs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.empirical.run/api/v2/analytics/test-runs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.empirical.run/api/v2/analytics/test-runs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.empirical.run/api/v2/analytics/test-runs")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.empirical.run/api/v2/analytics/test-runs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"daily": [
{
"date": "<string>",
"run_count": 123,
"passed_runs": 123,
"failed_runs": 123,
"error_runs": 123,
"cancelled_runs": 123,
"rerun_count": 123,
"total_tests": 123,
"passed_tests": 123,
"failed_tests": 123,
"failed_tests_after_snooze": 123,
"flaky_tests": 123
}
],
"summary": {
"total_runs": 123,
"passed_runs": 123,
"failed_runs": 123,
"error_runs": 123,
"pass_rate": 123,
"avg_tests_per_run": 123,
"rerun_count": 123,
"rerun_rate": 123
}
}
}{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}