Create an alert rule
POST
/api/v1/alerts/rules
const url = 'https://example.com/api/v1/alerts/rules';const options = { method: 'POST', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"channel_ids":[1],"cooldown_minutes":1,"enabled":true,"environment_id":1,"info":"example","match_field":"example","match_type":"example","match_value":"example","name":"example","node_uuid":"example","source":"example","status_severity":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v1/alerts/rules \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: application/json' \ --data '{ "channel_ids": [ 1 ], "cooldown_minutes": 1, "enabled": true, "environment_id": 1, "info": "example", "match_field": "example", "match_type": "example", "match_value": "example", "name": "example", "node_uuid": "example", "source": "example", "status_severity": "example" }'Creates a new alert rule for the given environment (or global when environment_id is 0).
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Request body
Media typeapplication/json
object
channel_ids
Array<integer>
cooldown_minutes
integer
enabled
boolean
environment_id
integer
info
string
match_field
string
match_type
string
match_value
string
name
string
node_uuid
NodeUUID optionally scopes the rule to one node (used by the node detail page’s “Alert on this node” button). Empty = all nodes.
string
source
string
status_severity
string
Examplegenerated
{ "channel_ids": [ 1 ], "cooldown_minutes": 1, "enabled": true, "environment_id": 1, "info": "example", "match_field": "example", "match_type": "example", "match_value": "example", "name": "example", "node_uuid": "example", "source": "example", "status_severity": "example"}Responses
Section titled “Responses”Created
Media typeapplication/json
object
channel_ids
Array<integer>
cooldown_minutes
integer
created_at
string
enabled
boolean
environment_id
integer
id
integer
info
string
match_field
string
match_type
string
match_value
string
name
string
node_uuid
string
source
string
status_severity
string
updated_at
string
Examplegenerated
{ "channel_ids": [ 1 ], "cooldown_minutes": 1, "created_at": "example", "enabled": true, "environment_id": 1, "id": 1, "info": "example", "match_field": "example", "match_type": "example", "match_value": "example", "name": "example", "node_uuid": "example", "source": "example", "status_severity": "example", "updated_at": "example"}Bad request
Media typeapplication/json
object
code
string
error
string
Examplegenerated
{ "code": "example", "error": "example"}Unauthorized
Media typeapplication/json
object
code
string
error
string
Examplegenerated
{ "code": "example", "error": "example"}Forbidden
Media typeapplication/json
object
code
string
error
string
Examplegenerated
{ "code": "example", "error": "example"}Conflict
Media typeapplication/json
object
code
string
error
string
Examplegenerated
{ "code": "example", "error": "example"}Alerts disabled
Media typeapplication/json
object
code
string
error
string
Examplegenerated
{ "code": "example", "error": "example"}