Update an alert rule
Update a rule (enable/disable, thresholds).
curl -X PUT "https://api.autopil.ai/v1/alerts/rules/example_string" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"name": "John Doe",
"rule_type": "denial_spike",
"threshold": 42,
"window_minutes": 42,
"cooldown_minutes": 42,
"webhook_url": "example_string",
"email": "user@example.com",
"enabled": true
}'
import requests
import json
url = "https://api.autopil.ai/v1/alerts/rules/example_string"
headers = {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
data = {
"name": "John Doe",
"rule_type": "denial_spike",
"threshold": 42,
"window_minutes": 42,
"cooldown_minutes": 42,
"webhook_url": "example_string",
"email": "user@example.com",
"enabled": true
}
response = requests.put(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.autopil.ai/v1/alerts/rules/example_string", {
method: "PUT",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"name": "John Doe",
"rule_type": "denial_spike",
"threshold": 42,
"window_minutes": 42,
"cooldown_minutes": 42,
"webhook_url": "example_string",
"email": "user@example.com",
"enabled": true
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"name": "John Doe",
"rule_type": "denial_spike",
"threshold": 42,
"window_minutes": 42,
"cooldown_minutes": 42,
"webhook_url": "example_string",
"email": "user@example.com",
"enabled": true
}`)
req, err := http.NewRequest("PUT", "https://api.autopil.ai/v1/alerts/rules/example_string", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.autopil.ai/v1/alerts/rules/example_string')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Put.new(uri)
request['Content-Type'] = 'application/json'
request['X-API-Key'] = 'YOUR_API_KEY'
request.body = '{
"name": "John Doe",
"rule_type": "denial_spike",
"threshold": 42,
"window_minutes": 42,
"cooldown_minutes": 42,
"webhook_url": "example_string",
"email": "user@example.com",
"enabled": true
}'
response = http.request(request)
puts response.body
{
"name": "John Doe",
"rule_type": "denial_spike",
"threshold": 42,
"window_minutes": 42,
"cooldown_minutes": 42,
"webhook_url": "example_string",
"email": "user@example.com",
"enabled": true
}
PUT
/v1/alerts/rules/{rule_id}PUT
Base URLstring
Target server for requests. Edit to use your own host.
API Key (header: X-API-Key)
X-API-Keystring
RequiredAPI key with admin, read, or evaluate scope. Missing key → 401; invalid or revoked key → 403.
API key with
admin, read, or evaluate scope. Missing key → 401; invalid or revoked key → 403.
Content-Typestring
RequiredThe media type of the request body
Options: application/json
rule_typestring
RequiredOptions: denial_spike, new_source_access, isolation_violation, high_deny_rate
Request Preview
Response
Response will appear here after sending the request
Authentication
header
X-API-Keystring
RequiredAPI Key for authentication. API key with admin, read, or evaluate scope. Missing key → 401; invalid or revoked key → 403.
Path Parameters
Body
application/json
rule_typestring
RequiredAllowed values:
denial_spikenew_source_accessisolation_violationhigh_deny_rateResponses
namestring
Requiredrule_typestring
RequiredAllowed values:
denial_spikenew_source_accessisolation_violationhigh_deny_ratethresholdinteger
Requiredwindow_minutesinteger
cooldown_minutesinteger
webhook_urlstring
emailstring
enabledboolean
Was this page helpful?