Rules API¶
Manage monitoring rules programmatically. For an explanation of rule types and configuration, see Concepts > Rules.
Create Rule¶
Authentication: X-API-Key header or session cookie
Request Body¶
{
"name": "High Error Rate",
"rule_type": "threshold",
"config": {
"event_type": "error",
"field": "count",
"operator": ">",
"value": 10,
"window_minutes": 15,
"severity": "critical"
},
"tags": ["production"],
"category": "errors"
}
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | Rule display name |
rule_type |
string | Yes | threshold, missing_field, or volume |
config |
object | Yes | Type-specific configuration (see rule types) |
tags |
string[] | No | Labels for organization |
category |
string | No | Grouping category |
Response (201 Created)¶
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "High Error Rate",
"rule_type": "threshold",
"config": { "..." : "..." },
"is_active": true,
"tags": ["production"],
"category": "errors",
"created_at": "2026-02-11T14:00:00Z",
"updated_at": "2026-02-11T14:00:00Z"
}
Examples¶
curl -X POST https://api.getadwize.com/api/v1/rules/ \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "High Error Rate",
"rule_type": "threshold",
"config": {
"event_type": "error",
"field": "count",
"operator": ">",
"value": 10,
"window_minutes": 15,
"severity": "critical"
}
}'
import httpx
rule = {
"name": "High Error Rate",
"rule_type": "threshold",
"config": {
"event_type": "error",
"field": "count",
"operator": ">",
"value": 10,
"window_minutes": 15,
"severity": "critical",
},
"tags": ["production"],
}
response = httpx.post(
"https://api.getadwize.com/api/v1/rules/",
headers={"X-API-Key": "YOUR_API_KEY"},
json=rule,
)
created_rule = response.json()
print(created_rule["id"])
const rule = {
name: "High Error Rate",
rule_type: "threshold",
config: {
event_type: "error",
field: "count",
operator: ">",
value: 10,
window_minutes: 15,
severity: "critical"
},
tags: ["production"]
};
const response = await fetch("https://api.getadwize.com/api/v1/rules/", {
method: "POST",
headers: {
"X-API-Key": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify(rule)
});
const createdRule = await response.json();
console.log(createdRule.id);
List Rules¶
Authentication: X-API-Key header or session cookie
Query Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
active_only |
boolean | false |
Only return active rules |
tag |
string | — | Filter by tag |
category |
string | — | Filter by category |
skip |
integer | 0 |
Pagination offset |
limit |
integer | 100 |
Page size |
Response¶
[
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "High Error Rate",
"rule_type": "threshold",
"config": { "..." : "..." },
"is_active": true,
"tags": ["production"],
"category": "errors",
"created_at": "2026-02-11T14:00:00Z",
"updated_at": "2026-02-11T14:00:00Z"
}
]
Get Rule¶
Returns a single rule by ID.
Authentication: X-API-Key header or session cookie
Update Rule¶
Partial update -- only include fields you want to change.
Authentication: X-API-Key header or session cookie
Example: Disable a Rule¶
Delete Rule¶
Permanently removes the rule. Existing alerts generated by this rule are not deleted.
Authentication: X-API-Key header or session cookie
Response: 204 No Content