curl --request PATCH \
--url https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metricGroupId": "metricGroup_123",
"specificationId": "specification_123",
"window": "ONE_HOUR",
"badSessionScore": 0.5,
"threshold": 3,
"recipients": [
"team@example.com"
],
"webhookUrl": "https://hooks.slack.com/services/T000/B000/XXXX"
}
'import requests
url = "https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}"
payload = {
"metricGroupId": "metricGroup_123",
"specificationId": "specification_123",
"window": "ONE_HOUR",
"badSessionScore": 0.5,
"threshold": 3,
"recipients": ["team@example.com"],
"webhookUrl": "https://hooks.slack.com/services/T000/B000/XXXX"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metricGroupId: 'metricGroup_123',
specificationId: 'specification_123',
window: 'ONE_HOUR',
badSessionScore: 0.5,
threshold: 3,
recipients: ['team@example.com'],
webhookUrl: 'https://hooks.slack.com/services/T000/B000/XXXX'
})
};
fetch('https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}', 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.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}",
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([
'metricGroupId' => 'metricGroup_123',
'specificationId' => 'specification_123',
'window' => 'ONE_HOUR',
'badSessionScore' => 0.5,
'threshold' => 3,
'recipients' => [
'team@example.com'
],
'webhookUrl' => 'https://hooks.slack.com/services/T000/B000/XXXX'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}"
payload := strings.NewReader("{\n \"metricGroupId\": \"metricGroup_123\",\n \"specificationId\": \"specification_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ],\n \"webhookUrl\": \"https://hooks.slack.com/services/T000/B000/XXXX\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metricGroupId\": \"metricGroup_123\",\n \"specificationId\": \"specification_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ],\n \"webhookUrl\": \"https://hooks.slack.com/services/T000/B000/XXXX\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metricGroupId\": \"metricGroup_123\",\n \"specificationId\": \"specification_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ],\n \"webhookUrl\": \"https://hooks.slack.com/services/T000/B000/XXXX\"\n}"
response = http.request(request)
puts response.read_body{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}Update a monitor alert rule
Patches one or more fields of an alert rule. The merged rule (patch over the stored row) is what gets validated. The type and the kind of target (metric family or Specification) cannot change: delete the rule and create a new one. A webhook URL set for the first time gets its signing secret generated; read it with regenerate-alert-rule-webhook-secret.
curl --request PATCH \
--url https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metricGroupId": "metricGroup_123",
"specificationId": "specification_123",
"window": "ONE_HOUR",
"badSessionScore": 0.5,
"threshold": 3,
"recipients": [
"team@example.com"
],
"webhookUrl": "https://hooks.slack.com/services/T000/B000/XXXX"
}
'import requests
url = "https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}"
payload = {
"metricGroupId": "metricGroup_123",
"specificationId": "specification_123",
"window": "ONE_HOUR",
"badSessionScore": 0.5,
"threshold": 3,
"recipients": ["team@example.com"],
"webhookUrl": "https://hooks.slack.com/services/T000/B000/XXXX"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metricGroupId: 'metricGroup_123',
specificationId: 'specification_123',
window: 'ONE_HOUR',
badSessionScore: 0.5,
threshold: 3,
recipients: ['team@example.com'],
webhookUrl: 'https://hooks.slack.com/services/T000/B000/XXXX'
})
};
fetch('https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}', 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.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}",
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([
'metricGroupId' => 'metricGroup_123',
'specificationId' => 'specification_123',
'window' => 'ONE_HOUR',
'badSessionScore' => 0.5,
'threshold' => 3,
'recipients' => [
'team@example.com'
],
'webhookUrl' => 'https://hooks.slack.com/services/T000/B000/XXXX'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}"
payload := strings.NewReader("{\n \"metricGroupId\": \"metricGroup_123\",\n \"specificationId\": \"specification_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ],\n \"webhookUrl\": \"https://hooks.slack.com/services/T000/B000/XXXX\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metricGroupId\": \"metricGroup_123\",\n \"specificationId\": \"specification_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ],\n \"webhookUrl\": \"https://hooks.slack.com/services/T000/B000/XXXX\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galtea.ai/monitors/{monitorId}/alert-rules/{alertRuleId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metricGroupId\": \"metricGroup_123\",\n \"specificationId\": \"specification_123\",\n \"window\": \"ONE_HOUR\",\n \"badSessionScore\": 0.5,\n \"threshold\": 3,\n \"recipients\": [\n \"team@example.com\"\n ],\n \"webhookUrl\": \"https://hooks.slack.com/services/T000/B000/XXXX\"\n}"
response = http.request(request)
puts response.read_body{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}Authorizations
API key authorization. Pass your API key in the Authorization header as a Bearer token. Both new (gsk_*) and legacy (gsk-) API keys are accepted, e.g. Authorization: Bearer gsk_... or Authorization: Bearer gsk-....
Path Parameters
Monitor ID
"monitor_123"
Alert rule ID
"monitorAlertRule_123"
Body
A metric family this monitor scores. Only a rule that watches a metric family accepts it. Mutually exclusive with specificationId.
1"metricGroup_123"
A Specification this monitor binds. Only a rule that watches a Specification accepts it. Mutually exclusive with metricGroupId.
1"specification_123"
The trailing window the rule evaluates
FIFTEEN_MINUTES, ONE_HOUR, SIX_HOURS, TWENTY_FOUR_HOURS "ONE_HOUR"
BAD_SESSION_COUNT only: a session counts as bad at or below this score. Must be null or left out for NO_SCORE_RATE.
0.5
The value the rule fires on, by type: a whole count of bad sessions for BAD_SESSION_COUNT, a percent above 0 and at most 100 for NO_SCORE_RATE
3
Email addresses notified when the rule fires (0 to 20). A rule needs at least one address or a webhookUrl.
20["team@example.com"]
URL that receives a signed POST when an alert opens or recovers. It must use https, unless the deployment allows http. A Slack incoming-webhook URL posts a message to its channel. Write-only: responses show only its host and port. On update, null removes it and leaving it out keeps it. Read the signing secret with regenerate-alert-rule-webhook-secret.
1 - 2048"https://hooks.slack.com/services/T000/B000/XXXX"
Response
Alert rule updated successfully