Skip to main content
PATCH
/
monitors
/
{monitor_id}
Update a monitor
curl --request PATCH \
  --url https://api.coval.dev/v1/monitors/{monitor_id} \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "name": "<string>",
  "description": "<string>",
  "evaluation_type": "ON_RUN_COMPLETE",
  "cooldown_seconds": 43200,
  "custom_message_template": "<string>",
  "agent_ids": [
    "<string>"
  ],
  "required_tags": [
    "<string>"
  ],
  "scheduled_run_ids": [
    "<string>"
  ],
  "conditions": [
    {
      "metric_id": "<string>",
      "threshold_float": 123,
      "threshold_string": "<string>",
      "window_size_days": 183,
      "window_size_runs": 5000,
      "match_value": "<string>"
    }
  ],
  "channels": [
    {
      "config": {}
    }
  ]
}
'
import requests

url = "https://api.coval.dev/v1/monitors/{monitor_id}"

payload = {
"name": "<string>",
"description": "<string>",
"evaluation_type": "ON_RUN_COMPLETE",
"cooldown_seconds": 43200,
"custom_message_template": "<string>",
"agent_ids": ["<string>"],
"required_tags": ["<string>"],
"scheduled_run_ids": ["<string>"],
"conditions": [
{
"metric_id": "<string>",
"threshold_float": 123,
"threshold_string": "<string>",
"window_size_days": 183,
"window_size_runs": 5000,
"match_value": "<string>"
}
],
"channels": [{ "config": {} }]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
evaluation_type: 'ON_RUN_COMPLETE',
cooldown_seconds: 43200,
custom_message_template: '<string>',
agent_ids: ['<string>'],
required_tags: ['<string>'],
scheduled_run_ids: ['<string>'],
conditions: [
{
metric_id: '<string>',
threshold_float: 123,
threshold_string: '<string>',
window_size_days: 183,
window_size_runs: 5000,
match_value: '<string>'
}
],
channels: [{config: {}}]
})
};

fetch('https://api.coval.dev/v1/monitors/{monitor_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/monitors/{monitor_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'evaluation_type' => 'ON_RUN_COMPLETE',
'cooldown_seconds' => 43200,
'custom_message_template' => '<string>',
'agent_ids' => [
'<string>'
],
'required_tags' => [
'<string>'
],
'scheduled_run_ids' => [
'<string>'
],
'conditions' => [
[
'metric_id' => '<string>',
'threshold_float' => 123,
'threshold_string' => '<string>',
'window_size_days' => 183,
'window_size_runs' => 5000,
'match_value' => '<string>'
]
],
'channels' => [
[
'config' => [

]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.coval.dev/v1/monitors/{monitor_id}"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"evaluation_type\": \"ON_RUN_COMPLETE\",\n \"cooldown_seconds\": 43200,\n \"custom_message_template\": \"<string>\",\n \"agent_ids\": [\n \"<string>\"\n ],\n \"required_tags\": [\n \"<string>\"\n ],\n \"scheduled_run_ids\": [\n \"<string>\"\n ],\n \"conditions\": [\n {\n \"metric_id\": \"<string>\",\n \"threshold_float\": 123,\n \"threshold_string\": \"<string>\",\n \"window_size_days\": 183,\n \"window_size_runs\": 5000,\n \"match_value\": \"<string>\"\n }\n ],\n \"channels\": [\n {\n \"config\": {}\n }\n ]\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("https://api.coval.dev/v1/monitors/{monitor_id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"evaluation_type\": \"ON_RUN_COMPLETE\",\n \"cooldown_seconds\": 43200,\n \"custom_message_template\": \"<string>\",\n \"agent_ids\": [\n \"<string>\"\n ],\n \"required_tags\": [\n \"<string>\"\n ],\n \"scheduled_run_ids\": [\n \"<string>\"\n ],\n \"conditions\": [\n {\n \"metric_id\": \"<string>\",\n \"threshold_float\": 123,\n \"threshold_string\": \"<string>\",\n \"window_size_days\": 183,\n \"window_size_runs\": 5000,\n \"match_value\": \"<string>\"\n }\n ],\n \"channels\": [\n {\n \"config\": {}\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.coval.dev/v1/monitors/{monitor_id}")

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

request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"evaluation_type\": \"ON_RUN_COMPLETE\",\n \"cooldown_seconds\": 43200,\n \"custom_message_template\": \"<string>\",\n \"agent_ids\": [\n \"<string>\"\n ],\n \"required_tags\": [\n \"<string>\"\n ],\n \"scheduled_run_ids\": [\n \"<string>\"\n ],\n \"conditions\": [\n {\n \"metric_id\": \"<string>\",\n \"threshold_float\": 123,\n \"threshold_string\": \"<string>\",\n \"window_size_days\": 183,\n \"window_size_runs\": 5000,\n \"match_value\": \"<string>\"\n }\n ],\n \"channels\": [\n {\n \"config\": {}\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "ulid": "01HZ0EXAMPLE00000000000000",
  "name": "Latency SLA Monitor",
  "evaluation_type": "ON_RUN_COMPLETE",
  "cooldown_seconds": 43200,
  "trigger_count": 123,
  "conditions": [
    {
      "ulid": "<string>",
      "metric_id": "<string>",
      "threshold_float": 123,
      "threshold_string": "<string>",
      "window_size_days": 183,
      "window_size_runs": 5000,
      "match_value": "<string>"
    }
  ],
  "channels": [
    {
      "ulid": "<string>",
      "config": {}
    }
  ],
  "create_time": "2023-11-07T05:31:56Z",
  "update_time": "2023-11-07T05:31:56Z",
  "description": "",
  "custom_message_template": "<string>",
  "agent_ids": [
    "<string>"
  ],
  "required_tags": [
    "<string>"
  ],
  "scheduled_run_ids": [
    "<string>"
  ],
  "last_triggered_at": "2023-11-07T05:31:56Z"
}
{
"error": {
"code": "INVALID_ARGUMENT",
"message": "Invalid request body",
"details": [
{
"field": "conditions",
"description": "Value error, List should have at least 1 item after validation"
}
]
}
}
{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication failed",
"details": [
{
"field": "X-API-Key",
"description": "Invalid or missing API key"
}
]
}
}
{
"error": {
"code": "PERMISSION_DENIED",
"message": "Insufficient permissions",
"details": [
{
"field": "permissions",
"description": "Required scope: monitors:read"
}
]
}
}
{
"error": {
"code": "NOT_FOUND",
"message": "Monitor not found",
"details": [
{
"field": "monitor_id",
"description": "Monitor '01HZ0EXAMPLE00000000000000' not found"
}
]
}
}
{
"error": {
"message": "<string>",
"details": [
{
"field": "<string>",
"description": "<string>"
}
]
}
}
{
"error": {
"code": "INTERNAL",
"message": "Internal server error",
"details": [
{
"description": "An unexpected error occurred"
}
]
}
}

Authorizations

X-API-Key
string
header
required

API key for authentication

Path Parameters

monitor_id
string
required

Monitor ULID

Pattern: ^[0-9A-Z]{26}$

Body

application/json
name
string
Maximum string length: 200
description
string
Maximum string length: 2000
evaluation_type
enum<string>

When the monitor evaluates

Available options:
ON_RUN_COMPLETE
scope
enum<string>

Which runs the monitor applies to

Available options:
ALL,
MONITORING,
SIMULATION
match_mode
enum<string>

How multiple conditions are combined (AND vs OR)

Available options:
ALL,
ANY
cooldown_seconds
integer
Required range: 0 <= x <= 86400
custom_message_template
string | null
agent_ids
string[] | null
required_tags
string[] | null
scheduled_run_ids
string[] | null
conditions
object[]

Replaces all existing conditions

Minimum array length: 1
channels
object[]

Replaces all existing channels

Response

Monitor updated

ulid
string
required

Monitor ULID

Pattern: ^[0-9A-Z]{26}$
Example:

"01HZ0EXAMPLE00000000000000"

name
string
required

Human-readable monitor name

Maximum string length: 200
Example:

"Latency SLA Monitor"

status
enum<string>
required

Monitor status

Available options:
ACTIVE,
DELETED
evaluation_type
enum<string>
required

When the monitor evaluates

Available options:
ON_RUN_COMPLETE
scope
enum<string>
required

Which runs the monitor applies to

Available options:
ALL,
MONITORING,
SIMULATION
match_mode
enum<string>
required

How multiple conditions are combined (AND vs OR)

Available options:
ALL,
ANY
cooldown_seconds
integer
required

Minimum seconds between triggers

Required range: 0 <= x <= 86400
trigger_count
integer
required

Number of times this monitor has triggered

conditions
object[]
required

Evaluation conditions

channels
object[]
required

Notification channels

create_time
string<date-time>
required

Creation timestamp

update_time
string<date-time>
required

Last update timestamp

description
string
default:""

Optional description

custom_message_template
string | null

Custom notification message template

Maximum string length: 5000
agent_ids
string[] | null

Restrict to specific agent IDs

required_tags
string[] | null

Restrict to runs with these tags

scheduled_run_ids
string[] | null

Restrict to runs originating from these scheduled runs

last_triggered_at
string<date-time> | null

Last trigger timestamp