Rules

Add, list and delete the edge rules of a zone, IP and country rules, WAF exceptions and rate limits.

On this page

Edge rules of a zone, applied by the edge to every proxied name or only to the names listed in hosts. Four kinds exist, ip, geo, waf_exception and rate_limit. See WAF and Rules.

OperationEndpoint
List rulesGET /v1/orgs/{org}/zones/{zone}/rules
Create rulePOST /v1/orgs/{org}/zones/{zone}/rules
Delete ruleDELETE /v1/orgs/{org}/zones/{zone}/rules/{rule}

List rules

GET /v1/orgs/{org}/zones/{zone}/rules

Lists the edge rules of the zone with their ids and the names each one is limited to (hosts; empty means every name).

Required role: readonly or higher.

Parameters

NameInTypeRequiredDescription
orgpathstring (uuid)YesOrganization id. Every route checks that it is the token's organization (otherwise 404).
zonepathstring (uuid)YesZone id (see List zones).

Response

  • 200: Returns items, an array of ZoneRule.
FieldTypeDescription
items[].kindstringOne of ip, geo, waf_exception, rate_limit.
items[].ipstringIP or CIDR.
items[].actionstringOne of block, allow.
items[].country_codestringISO 3166-1 alpha-2 country code. Pattern ^[A-Za-z]{2}$.
items[].rule_idintegerId of the rule. Minimum 0.
items[].path_patternstring"" or * = all; ending in * = prefix; otherwise exact.
items[].methodstring
items[].rpmintegerMinimum 0.
items[].burstintegerDefault 0. Minimum 0.
items[].notestringAt most 500 characters.
items[].hostsarray of stringNames it applies to; absent = every name of the zone.
items[].idintegerId.
items[].zone_idstring (uuid)Zone id.
items[].created_atstring (date-time)Creation time.

Example

curl "https://dash.openwaf.dev/v1/orgs/$OPENWAF_ORG/zones/6f1d2c3b-8a4e-4b7d-9c21-5e3f7a8b9c0d/rules" \
  -H "Authorization: Bearer $OPENWAF_TOKEN"
200
{
  "items": [
    {
      "id": 3,
      "zone_id": "6f1d2c3b-8a4e-4b7d-9c21-5e3f7a8b9c0d",
      "kind": "ip",
      "ip": "203.0.113.0/24",
      "action": "block",
      "note": "Abusive scanner",
      "hosts": [],
      "created_at": "2026-10-27T09:30:00Z"
    }
  ]
}

Create rule

POST /v1/orgs/{org}/zones/{zone}/rules

Adds an edge rule. The fields depend on kind:

kindFields
ipip (address or CIDR), action
geocountry_code, action
waf_exceptionrule_id (0 = every WAF rule), path_pattern
rate_limitpath_pattern, method, rpm, burst

rate_limit rules are the advanced, per-path rate limits; the basic per-IP limit is rate_limit_rpm in the edge settings. hosts limits the rule to those names (the zone or below it); a name without a proxied record gives a warning.

Required role: tech or higher.

Change controls: dry_run · If-Match (optional) · X-Change-Reason (required)

Parameters

NameInTypeRequiredDescription
orgpathstring (uuid)YesOrganization id. Every route checks that it is the token's organization (otherwise 404).
zonepathstring (uuid)YesZone id (see List zones).
X-Change-ReasonheaderstringYesReason of the change: 1-500 UTF-8 characters after trimming spaces, no control characters. If it is missing or invalid: 422 reason_required. 1 to 500 characters.
If-MatchheaderstringNoExpected configuration version, e.g. "12" (W/ accepted). If it is not the current one: 412 version_conflict.
dry_runquerystringNo1/true simulates the change: answers 200 with the plan (Applied) and saves nothing. 0/false accepted; any other value: 400. One of 1, true, 0, false.

Request body

Content type application/json. Schema: RuleInput.

FieldTypeRequiredDescription
kindstringYesOne of ip, geo, waf_exception, rate_limit.
ipstringNoIP or CIDR.
actionstringNoOne of block, allow.
country_codestringNoISO 3166-1 alpha-2 country code. Pattern ^[A-Za-z]{2}$.
rule_idintegerNoId of the rule. Minimum 0.
path_patternstringNo"" or * = all; ending in * = prefix; otherwise exact.
methodstringNo
rpmintegerNoMinimum 0.
burstintegerNoDefault 0. Minimum 0.
notestringNoAt most 500 characters.
hostsarray of stringNoNames of the zone (the zone or below it) it applies to; absent or empty = all.

Response

  • 200: With dry_run=1, the plan of the change (Applied); nothing is saved.
  • 201: Created. Returns ZoneRule.
FieldTypeDescription
kindstringOne of ip, geo, waf_exception, rate_limit.
ipstringIP or CIDR.
actionstringOne of block, allow.
country_codestringISO 3166-1 alpha-2 country code. Pattern ^[A-Za-z]{2}$.
rule_idintegerId of the rule. Minimum 0.
path_patternstring"" or * = all; ending in * = prefix; otherwise exact.
methodstring
rpmintegerMinimum 0.
burstintegerDefault 0. Minimum 0.
notestringAt most 500 characters.
hostsarray of stringNames it applies to; absent = every name of the zone.
idintegerId.
zone_idstring (uuid)Zone id.
created_atstring (date-time)Creation time.

Response headers: ETag, X-Config-Version.

Errors

StatusDescription
400Malformed request (bad_request).
409zone_merged: the zone is merged into another one.
412version_conflict: If-Match does not match the current version.
422Validation error (invalid) or missing or invalid reason (reason_required).

Example

curl -X POST "https://dash.openwaf.dev/v1/orgs/$OPENWAF_ORG/zones/6f1d2c3b-8a4e-4b7d-9c21-5e3f7a8b9c0d/rules" \
  -H "Authorization: Bearer $OPENWAF_TOKEN" \
  -H "X-Change-Reason: Block an abusive network" \
  -H 'If-Match: "12"' \
  -H "Content-Type: application/json" \
  --data '{
    "kind": "ip",
    "ip": "203.0.113.0/24",
    "action": "block",
    "note": "Abusive scanner"
  }'
201
{
  "id": 3,
  "zone_id": "6f1d2c3b-8a4e-4b7d-9c21-5e3f7a8b9c0d",
  "kind": "ip",
  "ip": "203.0.113.0/24",
  "action": "block",
  "note": "Abusive scanner",
  "hosts": [],
  "created_at": "2026-10-27T09:30:00Z"
}

Delete rule

DELETE /v1/orgs/{org}/zones/{zone}/rules/{rule}

Removes an edge rule of the zone.

Required role: tech or higher.

Change controls: dry_run · If-Match (optional) · X-Change-Reason (required)

Parameters

NameInTypeRequiredDescription
orgpathstring (uuid)YesOrganization id. Every route checks that it is the token's organization (otherwise 404).
zonepathstring (uuid)YesZone id (see List zones).
rulepathintegerYesRule id.
X-Change-ReasonheaderstringYesReason of the change: 1-500 UTF-8 characters after trimming spaces, no control characters. If it is missing or invalid: 422 reason_required. 1 to 500 characters.
If-MatchheaderstringNoExpected configuration version, e.g. "12" (W/ accepted). If it is not the current one: 412 version_conflict.
dry_runquerystringNo1/true simulates the change: answers 200 with the plan (Applied) and saves nothing. 0/false accepted; any other value: 400. One of 1, true, 0, false.

Response

  • 200: With dry_run=1, the plan of the change (Applied); nothing is saved.
  • 204: Deleted. No body.

Response headers: ETag, X-Config-Version.

Errors

StatusDescription
400Malformed request (bad_request).
404Not found, or not visible to the token (not_found).
409zone_merged: the zone is merged into another one.
412version_conflict: If-Match does not match the current version.
422Validation error (invalid) or missing or invalid reason (reason_required).

Example

curl -X DELETE "https://dash.openwaf.dev/v1/orgs/$OPENWAF_ORG/zones/6f1d2c3b-8a4e-4b7d-9c21-5e3f7a8b9c0d/rules/3" \
  -H "Authorization: Bearer $OPENWAF_TOKEN" \
  -H "X-Change-Reason: The network is no longer abusive" \
  -H 'If-Match: "12"'

Last updated:

↑↓ to navigate↵ to openesc to close