Firewall Rules
Create and manage firewall rules through the API.
Firewall rules are nested under domains. See Firewall Rules for detailed documentation on condition types and best practices.
List rules
GET /domains/:id/firewallCreate rule
POST /domains/:id/firewall| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | A label for the rule |
action | string | Yes | allow, block, or rate_limit |
condition | object | Yes | What to match (see below) |
priority | number | No | Lower number = higher priority (defaults to 100) |
Condition formats:
// IP address
{"type": "ip_address", "address": "1.2.3.4"}
// CIDR range
{"type": "ip_range", "cidr": "10.0.0.0/8"}
// Country (ISO 3166-1 alpha-2)
{"type": "country", "code": "CN"}
// Protocol version (Java and Geyser only)
{"type": "protocol_version", "min": 760}
// Username regex (Java and Geyser only)
{"type": "username", "pattern": "^Bot_\\d+$"}Rate limit action:
When the action is rate_limit, include the rate in the request body:
{
"name": "Rate limit US",
"action": "rate_limit",
"condition": {"type": "country", "code": "US"},
"priority": 50,
"rate_limit": {"max_per_second": 10}
}Bulk import
POST /domains/:id/firewall/bulkImport multiple rules at once. Accepts {"rules": [...]} with the same format as the create endpoint.
Update rule
PUT /domains/:id/firewall/:ridDelete rule
DELETE /domains/:id/firewall/:rid