POST
/api/v1/monitoring/alertsCreate an alert rule
Create alert with threshold, anomaly, trend, or absence condition.
Authentication
Send Authorization: Bearer YOUR_API_KEY on every request. Generate API keys at /dashboard/api-keys.
Request body required
Example
{
"name": "string",
"condition": {
"type": "threshold",
"metric": "string"
},
"severity": "critical",
"cooldownMs": 0
}Schema
{
"application/json": {
"schema": {
"type": "object",
"required": [
"name",
"condition",
"severity"
],
"properties": {
"name": {
"type": "string"
},
"condition": {
"type": "object",
"required": [
"type",
"metric"
],
"properties": {
"type": {
"type": "string",
"enum": [
"threshold",
"anomaly",
"trend",
"absence"
]
},
"metric": {
"type": "string"
}
}
},
"severity": {
"type": "string",
"enum": [
"critical",
"warning",
"info"
]
},
"cooldownMs": {
"type": "integer"
}
}
}
}
}Response
All status codes
201Alert rule created
Code samples
cURL
curl -X POST \
https://evalguard.ai/api/v1/monitoring/alerts \
-H "Authorization: Bearer $EVALGUARD_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "string", "condition": { "type": "threshold", "metric": "string" }, "severity": "critical", "cooldownMs": 0 }'TypeScript
import { EvalGuard } from "@evalguard/sdk";
const client = new EvalGuard({ apiKey: process.env.EVALGUARD_API_KEY });
const response = await client.request({
method: "POST",
path: "/api/v1/monitoring/alerts",
body: {
"name": "string",
"condition": {
"type": "threshold",
"metric": "string"
},
"severity": "critical",
"cooldownMs": 0
},
});
console.log(response);Python
from evalguard import EvalGuard
import os
client = EvalGuard(api_key=os.environ["EVALGUARD_API_KEY"])
response = client.request(
method="POST",
path="/api/v1/monitoring/alerts",
body={
"name": "string",
"condition": {
"type": "threshold",
"metric": "string"
},
"severity": "critical",
"cooldownMs": 0
},
)
print(response)Go
package main
import (
"context"
"fmt"
"os"
"github.com/evalguard/evalguard-go"
)
func main() {
client := evalguard.NewClient(os.Getenv("EVALGUARD_API_KEY"))
resp, err := client.Request(context.Background(), "POST", "/api/v1/monitoring/alerts", map[string]any{"name": "string", "condition": map[string]any{"type": "threshold", "metric": "string"}, "severity": "critical", "cooldownMs": 0})
if err != nil { panic(err) }
fmt.Println(resp)
}