POST /api/v1/alerts/routing/rules
alerts.routing.manage. A new rule goes last; Reorder routing rules moves it up. An organization has at most 200 routing rules.
| Field | Type | Description |
|---|---|---|
name | string | Required; 1 to 128 characters once trimmed. |
enabled | boolean | Defaults to true. |
conditions | array | At most 16, empty by default. A key has 1 to 512 characters; equals, not_equals and matches take one value each, in takes 1 to 100, each at most 512 characters; the pattern of matches must compile. |
min_severity | string | null | info, warning, error or critical; any severity by default. |
origins | array | Some of rule, external and synthetic; empty by default, meaning all. |
target | object | Required. {"kind": "team", "team_id": …} must be a team of the organization, {"kind": "policy", "policy_id": …} an escalation policy of the organization. |
curl -X POST http://localhost:5080/api/v1/alerts/routing/rules \
-H "authorization: Bearer $MS_TOKEN" \
-H "content-type: application/json" \
-d '{"name": "Payments in production", "conditions": [{"key": "env", "operator": "equals", "values": ["prod"]}], "min_severity": "error", "target": {"kind": "team", "team_id": "<team-id>"}}'
| Status | Cause |
|---|---|
400 | A field is wrong: an empty name, the wrong number of values for a condition, a pattern that does not compile, a target team or policy that does not exist, or 200 rules already. |
403 | The token lacks alerts.routing.manage. |
422 | name or target is missing, or a value is not recognized, such as an unknown operator. The response is plain text. |