curl --request GET \
--url https://api.cloud.corbado.io/v1/observe/alertRules \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.cloud.corbado.io/v1/observe/alertRules"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.cloud.corbado.io/v1/observe/alertRules', 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.cloud.corbado.io/v1/observe/alertRules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.cloud.corbado.io/v1/observe/alertRules"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.cloud.corbado.io/v1/observe/alertRules")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloud.corbado.io/v1/observe/alertRules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"id": "<string>",
"name": "<string>",
"ruleType": "login_success_rate",
"rule": {
"version": 1,
"type": "login_success_rate",
"window": "<string>",
"conditions": [
{
"severity": "info",
"operator": "above",
"threshold": 123
}
],
"evaluationDelay": "<string>",
"groupBy": [
"<string>"
],
"maxInstances": 250,
"settings": {},
"recovery": {
"operator": "above",
"threshold": 123
},
"for": "<string>",
"noData": "ok",
"overrides": [
{
"match": {},
"conditions": [
{
"severity": "info",
"operator": "above",
"threshold": 123
}
],
"recovery": {
"operator": "above",
"threshold": 123
},
"for": "<string>",
"noData": "ok",
"settings": {}
}
]
},
"contactPointID": "<string>",
"contactPointName": "<string>",
"status": "active",
"instanceTotals": {
"normal": 123,
"pending": 123,
"firing": 123,
"noData": 123,
"error": 123,
"total": 123
},
"createdMs": 123,
"updatedMs": 123,
"description": "<string>",
"labels": {},
"lastEvaluatedMs": 123,
"lastErrorReason": "rule_type_not_implemented",
"lastErrorMessage": "<string>"
}
]{
"error": {
"message": "Validation failed",
"details": [
{
"field": "projectID",
"message": "required"
}
]
}
}List alert rules
Lists Observe alert rules for the project. Paginated; sorted by createdMs (default descending).
Required API key permission: observe:alerts:read.
curl --request GET \
--url https://api.cloud.corbado.io/v1/observe/alertRules \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.cloud.corbado.io/v1/observe/alertRules"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.cloud.corbado.io/v1/observe/alertRules', 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.cloud.corbado.io/v1/observe/alertRules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.cloud.corbado.io/v1/observe/alertRules"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.cloud.corbado.io/v1/observe/alertRules")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloud.corbado.io/v1/observe/alertRules")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body[
{
"id": "<string>",
"name": "<string>",
"ruleType": "login_success_rate",
"rule": {
"version": 1,
"type": "login_success_rate",
"window": "<string>",
"conditions": [
{
"severity": "info",
"operator": "above",
"threshold": 123
}
],
"evaluationDelay": "<string>",
"groupBy": [
"<string>"
],
"maxInstances": 250,
"settings": {},
"recovery": {
"operator": "above",
"threshold": 123
},
"for": "<string>",
"noData": "ok",
"overrides": [
{
"match": {},
"conditions": [
{
"severity": "info",
"operator": "above",
"threshold": 123
}
],
"recovery": {
"operator": "above",
"threshold": 123
},
"for": "<string>",
"noData": "ok",
"settings": {}
}
]
},
"contactPointID": "<string>",
"contactPointName": "<string>",
"status": "active",
"instanceTotals": {
"normal": 123,
"pending": 123,
"firing": 123,
"noData": 123,
"error": 123,
"total": 123
},
"createdMs": 123,
"updatedMs": 123,
"description": "<string>",
"labels": {},
"lastEvaluatedMs": 123,
"lastErrorReason": "rule_type_not_implemented",
"lastErrorMessage": "<string>"
}
]{
"error": {
"message": "Validation failed",
"details": [
{
"field": "projectID",
"message": "required"
}
]
}
}Authorizations
Use an Observe API key from the management console. The key selects the project and must grant the permission listed on the operation. Keep this key on your server.
Query Parameters
Filter by rule status.
active, paused Filter by rule type.
login_success_rate Filter to rules whose name contains this text, case-insensitively. A substring match rather than a prefix one, because someone searching for "checkout" means the rule with checkout anywhere in its name. Wildcards in the term are matched literally.
255Filter to rules that have at least one alert in any of these statuses - comma-separated, and read as "or". This is what selecting a status card above the rules list asks for, and it is a different question from status, which is whether the rule itself is running.
Omitting it is not the same as listing every status: a rule that has never been evaluated has no alerts at all, and belongs in the unfiltered list.
5normal, pending, firing, no_data, error Order direction by creation time.
asc, desc The page number to retrieve for paginated results.
1
The number of items to return per page. Useful for pagination.
20
Response
Paginated list of alert rules. Paging metadata is returned in X-Corbado-Page, X-Corbado-TotalPages, and X-Corbado-TotalItems response headers.
1000Alert rule ID (format aru-<number>).
login_success_rate The configuration of an alert rule: the generic envelope every rule type shares, plus one settings object belonging to the rule type named by type. Everything outside settings is implemented once, generically - the window is resolved and handed to the rule type as two absolute timestamps, and the conditions are applied to whatever number the rule type returned, so a rule type never sees the thresholds. Shape and vocabulary are validated here. The semantics that span fields - that the bands get stricter as the level does, that recovery sits on the lenient side of them, that the window is a whole number of days, and that groupBy names dimensions this project actually has - are validated when the rule is saved and again when it is evaluated, because only the second catches a project that changed after the rule was written.
Show child attributes
Show child attributes
Alert contact point ID (format acp-<number>) this rule notifies.
Name of the contact point this rule notifies, resolved from contactPointID so a rule can be displayed without a second request. Display-only - requests still reference the contact point by contactPointID.
active, paused How many of a rule's alert instances sit in each status, counted over all of them rather than over a page of them. This is what lets a rule row say "2 of 12 firing" without the client reading a single instance - and what keeps that number from quietly becoming "2 of however many were fetched" once a rule groups into more instances than one page holds. Every field is present, zero included, so a client can render the set without checking which keys exist. Counts include every instance the rule currently has.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
When the evaluation runner last attempted this rule, successfully or not. Absent means it has never been attempted, which every rule is for up to one evaluation interval after it is created or edited - a state worth showing rather than rendering as healthy.
Why the last evaluation attempt failed, absent when it succeeded. This is rule health, which is a different question from whether anything the rule watches is breaching: a rule here is not evaluating at all, so it is neither firing nor all-clear. An unclassified failure reports evaluation_failed rather than a value outside this list.
rule_type_not_implemented, config_invalid, series_not_available, dimension_not_available, too_many_instances, evaluation_failed The detail behind lastErrorReason, truncated for display. Absent when the last attempt succeeded.
Was this page helpful?