Create Alert Rule
curl --request POST \
--url https://api.example.com/v1/alert-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scope": "<unknown>",
"channels": [],
"condition": {
"p_horizon_days": 2,
"threshold": 0.5,
"consecutive_runs": 1
},
"enabled": true,
"snoozed_until": "<string>",
"threshold": {
"probability": 0.5,
"window_days": 123
},
"type": "threshold"
}
'import requests
url = "https://api.example.com/v1/alert-rules"
payload = {
"name": "<string>",
"scope": "<unknown>",
"channels": [],
"condition": {
"p_horizon_days": 2,
"threshold": 0.5,
"consecutive_runs": 1
},
"enabled": True,
"snoozed_until": "<string>",
"threshold": {
"probability": 0.5,
"window_days": 123
},
"type": "threshold"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
scope: '<unknown>',
channels: [],
condition: {p_horizon_days: 2, threshold: 0.5, consecutive_runs: 1},
enabled: true,
snoozed_until: '<string>',
threshold: {probability: 0.5, window_days: 123},
type: 'threshold'
})
};
fetch('https://api.example.com/v1/alert-rules', 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.example.com/v1/alert-rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'scope' => '<unknown>',
'channels' => [
],
'condition' => [
'p_horizon_days' => 2,
'threshold' => 0.5,
'consecutive_runs' => 1
],
'enabled' => true,
'snoozed_until' => '<string>',
'threshold' => [
'probability' => 0.5,
'window_days' => 123
],
'type' => 'threshold'
]),
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.example.com/v1/alert-rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scope\": \"<unknown>\",\n \"channels\": [],\n \"condition\": {\n \"p_horizon_days\": 2,\n \"threshold\": 0.5,\n \"consecutive_runs\": 1\n },\n \"enabled\": true,\n \"snoozed_until\": \"<string>\",\n \"threshold\": {\n \"probability\": 0.5,\n \"window_days\": 123\n },\n \"type\": \"threshold\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.example.com/v1/alert-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"scope\": \"<unknown>\",\n \"channels\": [],\n \"condition\": {\n \"p_horizon_days\": 2,\n \"threshold\": 0.5,\n \"consecutive_runs\": 1\n },\n \"enabled\": true,\n \"snoozed_until\": \"<string>\",\n \"threshold\": {\n \"probability\": 0.5,\n \"window_days\": 123\n },\n \"type\": \"threshold\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/alert-rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"scope\": \"<unknown>\",\n \"channels\": [],\n \"condition\": {\n \"p_horizon_days\": 2,\n \"threshold\": 0.5,\n \"consecutive_runs\": 1\n },\n \"enabled\": true,\n \"snoozed_until\": \"<string>\",\n \"threshold\": {\n \"probability\": 0.5,\n \"window_days\": 123\n },\n \"type\": \"threshold\"\n}"
response = http.request(request)
puts response.read_body{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}alert-rules
Create Alert Rule
Create a new alert rule.
Validates:
- name: non-empty
- type: “threshold” (default, legacy) | “crest” (V2 Wave 5C)
- type=threshold: scope non-empty string, threshold.probability 0.0-1.0, threshold.window_days >= 1
- type=crest: scope , condition
- channels: subset of valid channel values
POST
/
v1
/
alert-rules
Create Alert Rule
curl --request POST \
--url https://api.example.com/v1/alert-rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"scope": "<unknown>",
"channels": [],
"condition": {
"p_horizon_days": 2,
"threshold": 0.5,
"consecutive_runs": 1
},
"enabled": true,
"snoozed_until": "<string>",
"threshold": {
"probability": 0.5,
"window_days": 123
},
"type": "threshold"
}
'import requests
url = "https://api.example.com/v1/alert-rules"
payload = {
"name": "<string>",
"scope": "<unknown>",
"channels": [],
"condition": {
"p_horizon_days": 2,
"threshold": 0.5,
"consecutive_runs": 1
},
"enabled": True,
"snoozed_until": "<string>",
"threshold": {
"probability": 0.5,
"window_days": 123
},
"type": "threshold"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
scope: '<unknown>',
channels: [],
condition: {p_horizon_days: 2, threshold: 0.5, consecutive_runs: 1},
enabled: true,
snoozed_until: '<string>',
threshold: {probability: 0.5, window_days: 123},
type: 'threshold'
})
};
fetch('https://api.example.com/v1/alert-rules', 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.example.com/v1/alert-rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'scope' => '<unknown>',
'channels' => [
],
'condition' => [
'p_horizon_days' => 2,
'threshold' => 0.5,
'consecutive_runs' => 1
],
'enabled' => true,
'snoozed_until' => '<string>',
'threshold' => [
'probability' => 0.5,
'window_days' => 123
],
'type' => 'threshold'
]),
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.example.com/v1/alert-rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"scope\": \"<unknown>\",\n \"channels\": [],\n \"condition\": {\n \"p_horizon_days\": 2,\n \"threshold\": 0.5,\n \"consecutive_runs\": 1\n },\n \"enabled\": true,\n \"snoozed_until\": \"<string>\",\n \"threshold\": {\n \"probability\": 0.5,\n \"window_days\": 123\n },\n \"type\": \"threshold\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.example.com/v1/alert-rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"scope\": \"<unknown>\",\n \"channels\": [],\n \"condition\": {\n \"p_horizon_days\": 2,\n \"threshold\": 0.5,\n \"consecutive_runs\": 1\n },\n \"enabled\": true,\n \"snoozed_until\": \"<string>\",\n \"threshold\": {\n \"probability\": 0.5,\n \"window_days\": 123\n },\n \"type\": \"threshold\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/alert-rules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"scope\": \"<unknown>\",\n \"channels\": [],\n \"condition\": {\n \"p_horizon_days\": 2,\n \"threshold\": 0.5,\n \"consecutive_runs\": 1\n },\n \"enabled\": true,\n \"snoozed_until\": \"<string>\",\n \"threshold\": {\n \"probability\": 0.5,\n \"window_days\": 123\n },\n \"type\": \"threshold\"\n}"
response = http.request(request)
puts response.read_body{}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"ctx": {},
"input": "<unknown>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
Successful Response
The response is of type Response Create Alert Rule V1 Alert Rules Post · object.
⌘I