Skip to main content
GET
/
metrics
/
{metric_id}
/
baselines
/
{baseline_id}
Get metric baseline
curl --request GET \
  --url https://api.coval.dev/v1/metrics/{metric_id}/baselines/{baseline_id} \
  --header 'X-API-Key: <api-key>'
import requests

url = "https://api.coval.dev/v1/metrics/{metric_id}/baselines/{baseline_id}"

headers = {"X-API-Key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};

fetch('https://api.coval.dev/v1/metrics/{metric_id}/baselines/{baseline_id}', 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.coval.dev/v1/metrics/{metric_id}/baselines/{baseline_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);

$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.coval.dev/v1/metrics/{metric_id}/baselines/{baseline_id}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("X-API-Key", "<api-key>")

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.coval.dev/v1/metrics/{metric_id}/baselines/{baseline_id}")
.header("X-API-Key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.coval.dev/v1/metrics/{metric_id}/baselines/{baseline_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "ulid": "01HXKZ4M5N6P7Q8R9STVWXYZAB",
  "detection_method": "EWMA",
  "sigma_threshold": 123,
  "created_at": "2023-11-07T05:31:56Z",
  "last_updated_at": "2023-11-07T05:31:56Z",
  "metric_id": "<string>",
  "agent_id": "<string>",
  "test_set_id": "<string>",
  "persona_id": "<string>",
  "display_name": "<string>",
  "baseline_float": 123,
  "baseline_sigma": 123,
  "observation_count": 0,
  "sigma_bands": {},
  "last_processed_run_completed_at": "2023-11-07T05:31:56Z"
}
{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication failed",
"details": [
{
"field": "X-API-Key",
"description": "Invalid or missing API key"
}
]
}
}
{
"error": {
"code": "NOT_FOUND",
"message": "Metric not found",
"details": [
{
"field": "metric_id",
"description": "No metric found with this ID"
}
]
}
}
{
"error": {
"code": "INTERNAL",
"message": "Internal server error"
}
}

Authorizations

X-API-Key
string
header
required

API key for authentication

Path Parameters

metric_id
string
required

22-character metric ID

Pattern: ^[a-zA-Z0-9]{22}$
baseline_id
string
required

26-character baseline ULID.

Required string length: 26

Query Parameters

sigma_levels
integer[]

Comma-separated sigma multipliers used to populate sigma_bands in each baseline (e.g. 1,2,3).

Response

Baseline retrieved successfully

Anomaly-detection baseline for a metric.

ulid
string
required

Baseline ULID.

Example:

"01HXKZ4M5N6P7Q8R9STVWXYZAB"

status
enum<string>
required

Baseline lifecycle status.

Available options:
ACTIVE,
STANDBY,
ARCHIVED
detection_method
enum<string>
required

Anomaly detection algorithm. Currently only EWMA.

Available options:
EWMA
sigma_threshold
number
required

Sigmas from the baseline that constitute an anomaly.

direction
enum<string>
required

Which direction(s) of deviation count as anomalous.

Available options:
BOTH,
ABOVE,
BELOW
created_at
string<date-time>
required
last_updated_at
string<date-time>
required
metric_id
string | null

Metric ULID.

agent_id
string | null

Agent ID. Null for org-wide baselines.

test_set_id
string | null

Test set ULID. Null for monitoring.

persona_id
string | null

Persona ULID. Null when the baseline covers all personas.

display_name
string | null

User-facing label.

baseline_float
number | null

Current baseline mean estimate.

baseline_sigma
number | null

Current baseline standard deviation estimate.

observation_count
integer
default:0

Number of observations processed.

sigma_bands
object | null

Computed sigma bands keyed by level (e.g. upper_1sigma, lower_2sigma, upper_2sigma). Null when baseline stats are not yet populated. Levels controlled by the sigma_levels query param.

last_processed_run_completed_at
string<date-time> | null

Cursor: when the last processed run completed.