Skip to content

Rules API

Manage monitoring rules programmatically. For an explanation of rule types and configuration, see Concepts > Rules.

Create Rule

POST /api/v1/rules/

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

GET /api/v1/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"
  }
]
curl "https://api.getadwize.com/api/v1/rules/?active_only=true&tag=production" \
  -H "X-API-Key: YOUR_API_KEY"
import httpx

response = httpx.get(
    "https://api.getadwize.com/api/v1/rules/",
    headers={"X-API-Key": "YOUR_API_KEY"},
    params={"active_only": True, "tag": "production"},
)

for rule in response.json():
    print(rule["name"], rule["rule_type"], rule["is_active"])

Get Rule

GET /api/v1/rules/{rule_id}

Returns a single rule by ID.

Authentication: X-API-Key header or session cookie


Update Rule

PATCH /api/v1/rules/{rule_id}

Partial update -- only include fields you want to change.

Authentication: X-API-Key header or session cookie

Example: Disable a Rule

curl -X PATCH "https://api.getadwize.com/api/v1/rules/RULE_ID" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"is_active": false}'
import httpx

response = httpx.patch(
    f"https://api.getadwize.com/api/v1/rules/{rule_id}",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={"is_active": False},
)

Delete Rule

DELETE /api/v1/rules/{rule_id}

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

curl -X DELETE "https://api.getadwize.com/api/v1/rules/RULE_ID" \
  -H "X-API-Key: YOUR_API_KEY"