Skip to content

Create Alert Rule

POST /alerts
FieldTypeNotes
namestringrequiredmin length 1 max length 200
metricerror_rate | success_rate | failure_count | run_count | avg_latency_ms | p95_latency_ms | cost | token_total | queue_depth | suspension_age | queued_without_workers | provider_credit_remaining | providers_unreachablerequired—
comparatorgt | gte | lt | lterequired—
thresholdnumberrequired—
scopeworkspace | organization | platformoptionalDefault "workspace".
agent_idstring (uuid) | nulloptional—
window_secondsintegeroptionalDefault 300. min 60 max 86400
min_samplesintegeroptionalDefault 5. min 1 max 10000
severityinfo | warning | criticaloptionalDefault "warning".
cooldown_secondsintegeroptionalDefault 300. min 60 max 86400
notify_logbooleanoptionalDefault true.
notify_webhook_urlstring | nulloptional—
notify_secretstring | nulloptionalmin length 16 max length 200
is_activebooleanoptionalDefault true.
StatusDescriptionBody
201Successful ResponseAlertRuleView
422Validation ErrorHTTPValidationError

The body shows the fields the schema always carries. Which combination is legal is a service rule the schema cannot express, so read the description above before copying this.

Terminal window
curl -X POST https://your-deployment.example.com/alerts \
-H "Authorization: Bearer $COBRE_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "string",
"metric": "error_rate",
"comparator": "gt",
"threshold": 0
}'
FieldTypeNotes
idstring (uuid)required—
scopeworkspace | organization | platformrequired—
namestringrequired—
metricerror_rate | success_rate | failure_count | run_count | avg_latency_ms | p95_latency_ms | cost | token_total | queue_depth | suspension_age | queued_without_workers | provider_credit_remaining | providers_unreachablerequired—
comparatorgt | gte | lt | lterequired—
thresholdnumberrequired—
agent_idstring (uuid) | nullrequired, nullable—
window_secondsintegerrequired—
min_samplesintegerrequired—
severityinfo | warning | criticalrequired—
cooldown_secondsintegerrequired—
notify_logbooleanrequired—
notify_webhook_urlstring | nullrequired, nullable—
is_activebooleanrequired—
last_evaluated_atstring (date-time) | nullrequired, nullable—
last_valuenumber | nullrequired, nullable—
created_atstring (date-time)required—
updated_atstring (date-time)required—