Skip to main content
PATCH
/
metrics
/
{metric_id}
/
baselines
/
{baseline_id}
curl --request PATCH \
  --url https://api.coval.dev/v1/metrics/{metric_id}/baselines/{baseline_id} \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "status": "ACTIVE"
}
'
{
  "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": {
"message": "<string>",
"details": [
{
"field": "<string>",
"description": "<string>"
}
]
}
}
{
"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

Body

application/json

Request body for updating a baseline. All fields optional.

display_name
string | null

User-facing label.

Maximum string length: 200
sigma_threshold
number | null

Sigmas from the baseline that constitute an anomaly.

Required range: x > 0
direction
enum<string>

Which direction(s) of deviation count as anomalous.

Available options:
BOTH,
ABOVE,
BELOW
status
enum<string>

Baseline lifecycle status.

Available options:
ACTIVE,
STANDBY,
ARCHIVED

Response

Baseline updated 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.