Badges
Get an environment status badge
Renders an SVG status badge (passing/failing/running/etc.) for the latest test run of a project environment. Served unauthenticated for embedding in READMEs.
GET
/
api
/
badges
/
projects
/
{project_slug}
/
environments
/
{environment_slug}
Get an environment status badge
curl --request GET \
--url https://api.empirical.run/api/badges/projects/{project_slug}/environments/{environment_slug}import requests
url = "https://api.empirical.run/api/badges/projects/{project_slug}/environments/{environment_slug}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.empirical.run/api/badges/projects/{project_slug}/environments/{environment_slug}', 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/badges/projects/{project_slug}/environments/{environment_slug}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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/badges/projects/{project_slug}/environments/{environment_slug}"
req, _ := http.NewRequest("GET", url, nil)
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/badges/projects/{project_slug}/environments/{environment_slug}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.empirical.run/api/badges/projects/{project_slug}/environments/{environment_slug}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body<string>{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}Path Parameters
Slug of the project that owns the environment.
Minimum string length:
1Slug of the environment to render a badge for.
Minimum string length:
1Query Parameters
Restrict the badge to the latest run on this branch. Blank/whitespace is treated as unset (latest run across branches).
Left-hand label text on the badge. Blank/whitespace falls back to the default (empirical tests).
Response
The rendered SVG badge image.
SVG markup for the status badge.
Was this page helpful?
Get an environment status badge
curl --request GET \
--url https://api.empirical.run/api/badges/projects/{project_slug}/environments/{environment_slug}import requests
url = "https://api.empirical.run/api/badges/projects/{project_slug}/environments/{environment_slug}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.empirical.run/api/badges/projects/{project_slug}/environments/{environment_slug}', 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/badges/projects/{project_slug}/environments/{environment_slug}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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/badges/projects/{project_slug}/environments/{environment_slug}"
req, _ := http.NewRequest("GET", url, nil)
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/badges/projects/{project_slug}/environments/{environment_slug}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.empirical.run/api/badges/projects/{project_slug}/environments/{environment_slug}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body<string>{
"data": "<unknown>",
"error": {
"message": "<string>"
}
}