Skip to content

Enabling/Disabling Alerts

Enable or disable alerts to control when they trigger notifications.


Endpoint

PUT /api/alerts/:id/enable

Temporarily disable or re-enable an alert without deleting it.


Authentication

Requires API Key with Policy Definition permission.


Path Parameters

Parameter Type Description
id UUID Alert ID to enable/disable

Request Body

{
  "enable": false
}
Field Type Required Description
enable boolean Yes true to enable, false to disable

Response

Returns the updated alert object:

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "High-Volume PII Detection",
  "enable": false,
  "notificationTypes": ["email"],
  "updatedAt": 1704240000
}

Behavior

Disabling Alerts

When an alert is disabled:

  • Shield will not trigger notifications for this alert
  • Conditions are still evaluated but notifications are suppressed
  • The alert remains in the database and can be re-enabled
  • Alert logs continue to record events (but notifications aren't sent)

Enabling Alerts

When an alert is enabled:

  • Shield resumes monitoring and sending notifications
  • Threshold counters may reset depending on threshold type
  • Notifications sent immediately when conditions are met

Examples

Disable an Alert

Temporarily disable an alert without deleting it.

ALERT_ID="550e8400-e29b-41d4-a716-446655440000"

curl -X PUT "https://your-shield-host:8080/api/alerts/$ALERT_ID/enable" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enable": false}'
import requests

BASE_URL = "https://your-shield-host:8080"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}

alert_id = "550e8400-e29b-41d4-a716-446655440000"

response = requests.put(
    f"{BASE_URL}/api/alerts/{alert_id}/enable",
    headers=HEADERS,
    json={"enable": False}
)

print(f"Alert disabled: {not response.json()['enable']}")
const axios = require('axios');

const BASE_URL = 'https://your-shield-host:8080';
const HEADERS = { 'Authorization': 'Bearer YOUR_API_KEY' };

const alertId = '550e8400-e29b-41d4-a716-446655440000';

const response = await axios.put(
  `${BASE_URL}/api/alerts/${alertId}/enable`,
  { enable: false },
  { headers: HEADERS }
);

console.log(`Alert disabled: ${!response.data.enable}`);
Re-enable an Alert

Re-enable a previously disabled alert.

ALERT_ID="550e8400-e29b-41d4-a716-446655440000"

curl -X PUT "https://your-shield-host:8080/api/alerts/$ALERT_ID/enable" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enable": true}'
import requests

BASE_URL = "https://your-shield-host:8080"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}

alert_id = "550e8400-e29b-41d4-a716-446655440000"

response = requests.put(
    f"{BASE_URL}/api/alerts/{alert_id}/enable",
    headers=HEADERS,
    json={"enable": True}
)

print(f"Alert enabled: {response.json()['enable']}")
const axios = require('axios');

const BASE_URL = 'https://your-shield-host:8080';
const HEADERS = { 'Authorization': 'Bearer YOUR_API_KEY' };

const alertId = '550e8400-e29b-41d4-a716-446655440000';

const response = await axios.put(
  `${BASE_URL}/api/alerts/${alertId}/enable`,
  { enable: true },
  { headers: HEADERS }
);

console.log(`Alert enabled: ${response.data.enable}`);
Bulk Enable/Disable Alerts

Disable multiple alerts programmatically.

import requests

BASE_URL = "https://your-shield-host:8080"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}

# List of alert IDs to disable
alert_ids = [
    "uuid-1",
    "uuid-2",
    "uuid-3"
]

for alert_id in alert_ids:
    response = requests.put(
        f"{BASE_URL}/api/alerts/{alert_id}/enable",
        headers=HEADERS,
        json={"enable": False}
    )
    print(f"Disabled: {response.json()['name']}")
const axios = require('axios');

const BASE_URL = 'https://your-shield-host:8080';
const HEADERS = { 'Authorization': 'Bearer YOUR_API_KEY' };

// List of alert IDs to disable
const alertIds = [
  'uuid-1',
  'uuid-2',
  'uuid-3'
];

for (const alertId of alertIds) {
  const response = await axios.put(
    `${BASE_URL}/api/alerts/${alertId}/enable`,
    { enable: false },
    { headers: HEADERS }
  );
  console.log(`Disabled: ${response.data.name}`);
}

Error Responses

Status Code Description
400 Invalid request body
401 Invalid or expired API key
403 Insufficient permissions
404 Alert not found