POST /alerts/rules

Authentication

Bearer Token (hu_api_key)

Request Body required

application/json
monitor_id string REQUIRED
alert_channel_id string REQUIRED
on_down boolean REQUIRED
on_recovery boolean REQUIRED
on_degraded boolean REQUIRED

Responses

201 Rule created

No response body

curl -X POST 'https://happyuptime.com/api/v1/alerts/rules' \  -H 'Authorization: Bearer YOUR_API_TOKEN' \  -H 'Content-Type: application/json' \  -d '{  "monitor_id": "string",  "alert_channel_id": "string",  "on_down": true,  "on_recovery": true,  "on_degraded": false}'
const response = await fetch('https://happyuptime.com/api/v1/alerts/rules', {  method: 'POST',  headers: {      "Authorization": "Bearer YOUR_API_TOKEN",      "Content-Type": "application/json"  },  body: JSON.stringify({    "monitor_id": "string",    "alert_channel_id": "string",    "on_down": true,    "on_recovery": true,    "on_degraded": false  })});const data = await response.json();console.log(data);
import requestsheaders = {    'Authorization': 'Bearer YOUR_API_TOKEN'}response = requests.post('https://happyuptime.com/api/v1/alerts/rules', headers=headers, json={  "monitor_id": "string",  "alert_channel_id": "string",  "on_down": true,  "on_recovery": true,  "on_degraded": false})print(response.json())