Edgeweir
Reference

API: Access control

Procedures for site rules, platform rules, bulk redirects, IP lists, the IP check, bans, the greylist, challenges and CC mitigation, and OWASP CRS.

Access levels, authentication, idempotency keys and the error format: API overview.

Site rules

Protection of site API traffic is covered in API security. apiSecurity.get and results use GET; importOpenApi previews a document with a read-only POST; update replaces and publishes the full policy with PUT; confirmEndpoint updates discovery metadata with PUT. Paths and shapes are in that guide and the public OpenAPI document. These procedures use existing operator credentials and grant no additional service-account access.

  • Saving and restoring publish a configuration revision for the site's cluster (reason rules_updated) and audit site.rules_update and site.rule_restore (metadata: the rule count count; a restore also has the rule { id, name } and version).
  • Every save records a version for each rule it adds, changes or deletes; a change of order alone records none. Each rule keeps its last 50 versions; each site keeps its 100 most recently deleted rules.
  • Rule object and actions: Rule object, Rule actions. Expression language: Expressions. Behavior: Rules, IP lists, and GeoIP.
ProcedureMethod and pathAccess
rules.getGET /sites/{id}/rulesread
rules.savePUT /sites/{id}/ruleswrite
rules.versionsGET /sites/{id}/rules/{ruleId}/versionsread
rules.deletedGET /sites/{id}/rules/deletedread
rules.restorePOST /sites/{id}/rules/{ruleId}/restorewrite
rules.topLoggedGET /sites/{id}/rules/loggedread
rules.validatePOST /rules/validateread

rules.get

GET /sites/{id}/rules · read

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID

Response: Rule[], in saved order.

ErrorStatusCondition
SITE_NOT_FOUND404The site does not exist

rules.save

PUT /sites/{id}/rules · write

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID
rulesbodyarray<Rule>yesAt most 64; the banScope of a ban action must be siteReplaces all of the site's rules; they run in array order

A rule's id is kept when it is the ID of one of the site's rules; otherwise (omitted, or from another site) a new one is generated.

Response: the saved Rule[], with id.

ErrorStatusCondition
SITE_NOT_FOUND404The site does not exist
RULE_INVALID400Two rules have the same id; the originGroup of an origin action is not one of the site's origin groups; the site's saved rules or cache rule conditions do not compile
ORIGIN_HOST_HEADER_INVALID400The hostHeader of an origin action is not a host name or IP the nodes accept; data.hostHeader
IP_LIST_REFERENCE_UNKNOWN404An expression refers to an IP list that does not exist; data.lists holds the first 5 names, comma-separated

rules.versions

GET /sites/{id}/rules/{ruleId}/versions · read

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID
ruleIdpathuuidyes—Rule ID, deleted rules included

Response: Rule version[], highest version first. Empty when the rule is not the site's or has no versions.

ErrorStatusCondition
SITE_NOT_FOUND404The site does not exist

rules.deleted

GET /sites/{id}/rules/deleted · read

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID

Response: Rule version[], the last version of each deleted rule (change is deleted, rule is the content before deletion), most recently deleted first.

ErrorStatusCondition
SITE_NOT_FOUND404The site does not exist

rules.restore

POST /sites/{id}/rules/{ruleId}/restore · write

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID
ruleIdpathuuidyes—Rule ID
versionbodyintegeryes≥1A kept version number of the rule

Saves the version as the rule: in place when the rule exists; when it was deleted, under its old id after the last rule of its phase (at the end when the phase has no rules). The version is checked against today's rule checks. The new version has source restore and restoredFrom version.

Response: all of the site's Rule[] after the restore.

ErrorStatusCondition
SITE_NOT_FOUND404The site does not exist
RULE_VERSION_NOT_FOUND404The site keeps no such version of the rule (pruned, or another site's rule)
RULE_INVALID400The version no longer passes the rule checks; the rule ID is used by another rule; the origin group does not exist; the site's saved rules do not compile
RULE_LIMIT_REACHED400Restoring a deleted rule would exceed 64 rules; data.limit
ORIGIN_HOST_HEADER_INVALID400The hostHeader of an origin action is invalid; data.hostHeader
IP_LIST_REFERENCE_UNKNOWN404An expression refers to an IP list that does not exist; data.lists

rules.topLogged

GET /sites/{id}/rules/logged · read

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID
rangequeryenumno1h / 6h / 24h / 7d / 30d, default 24hTime range
limitqueryintegerno1–50, default 10Rules returned

Requests matched by log actions of the site's rules and of platform rules, from the nodes' per-minute counters (at most 20 rules per node, site and minute); approximate.

Response: { approximate: true, items, unsupportedNodes }.

FieldTypeDescription
items[].ruleIduuidRule ID
items[].namestring or nullThe rule's current name; null once the rule is deleted
items[].platformbooleanA platform rule
items[].requestsnumberMatched requests, sorted descending
unsupportedNodesintegerActive nodes of the site's cluster that do not count matches (no node capability rule-log-v1)
ErrorStatusCondition
SITE_NOT_FOUND404The site does not exist

rules.validate

POST /rules/validate · read

ParameterInTypeRequiredConstraints and defaultDescription
expressionbodystringyesAt most 16384 charactersThe expression to check
phasebodyenumyesA rule phase, see Rule objectThe phase the expression belongs to; ignored for kind cacheRule but still required
kindbodyenumnocondition / value / cacheRule, default conditioncondition: a rule condition; value: a value expression (redirect target, rewrite path, request or response header value, query parameter value); cacheRule: a cache rule condition

Response:

FieldTypeDescription
validbooleanWhether the expression is valid
positionintegerCharacter offset of the error (from 0); 0 when valid
messagestringReason in English; empty when valid
codeenumInvalid only: a stable reason code such as unknown_field, expected_token, ordered_comparison; every value is listed in the OpenAPI document
paramsobjectInvalid only: the values the reason names (string to string), such as token for expected_token

Platform rules

Platform rules apply to every site of every cluster and run before the site rules in each phase.

  • Saving and restoring publish a configuration revision for every cluster (reason rules_updated) and audit platform.rules_update and platform.rule_restore.
  • Versions are kept as for site rules: 50 versions per rule, the 100 most recently deleted rules.
ProcedureMethod and pathAccess
platformRules.getGET /platform-rulesread
platformRules.savePUT /platform-ruleswrite
platformRules.versionsGET /platform-rules/{ruleId}/versionsread
platformRules.deletedGET /platform-rules/deletedread
platformRules.restorePOST /platform-rules/{ruleId}/restorewrite

platformRules.get

GET /platform-rules · read

No parameters.

Response: Rule[], in saved order.

platformRules.save

PUT /platform-rules · write

ParameterInTypeRequiredConstraints and defaultDescription
rulesbodyarray<Rule>yesAt most 32Replaces all platform rules

A rule's id is kept when it is the ID of an existing platform rule; otherwise a new one is generated. A ban action of a platform rule may use banScope: "platform"; an origin action cannot choose an origin group.

Response: the saved Rule[].

ErrorStatusCondition
RULE_INVALID400Two rules have the same id; the originGroup of an origin action is not empty
ORIGIN_HOST_HEADER_INVALID400The hostHeader of an origin action is invalid; data.hostHeader
IP_LIST_REFERENCE_UNKNOWN404An expression refers to an IP list that does not exist; data.lists

platformRules.versions

GET /platform-rules/{ruleId}/versions · read

ParameterInTypeRequiredConstraints and defaultDescription
ruleIdpathuuidyes—Platform rule ID, deleted rules included

Response: Rule version[], highest version first; empty for a rule that is not a platform rule.

platformRules.deleted

GET /platform-rules/deleted · read

No parameters.

Response: Rule version[], the last version of each deleted platform rule, most recently deleted first.

platformRules.restore

POST /platform-rules/{ruleId}/restore · write

ParameterInTypeRequiredConstraints and defaultDescription
ruleIdpathuuidyes—Platform rule ID
versionbodyintegeryes≥1A kept version number of the rule

Works like rules.restore, with a limit of 32 rules.

Response: all platform Rule[] after the restore.

ErrorStatusCondition
RULE_VERSION_NOT_FOUND404No such platform rule version is kept
RULE_INVALID400The version no longer passes the rule checks; the rule ID is used by another rule
RULE_LIMIT_REACHED400Restoring a deleted rule would exceed 32 rules; data.limit
ORIGIN_HOST_HEADER_INVALID400The hostHeader of an origin action is invalid; data.hostHeader
IP_LIST_REFERENCE_UNKNOWN404An expression refers to an IP list that does not exist; data.lists

Bulk redirects

  • Saving publishes a configuration revision for the site's cluster (reason rules_updated) and audits site.bulk_redirects_update (metadata count, revision).
  • Bulk redirects need the node capability rules-v2. Behavior: Bulk redirects.
ProcedureMethod and pathAccess
bulkRedirects.getGET /sites/{id}/bulk-redirectsread
bulkRedirects.savePUT /sites/{id}/bulk-redirectswrite

bulkRedirects.get

GET /sites/{id}/bulk-redirects · read

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID

Response: Bulk redirect entry[], in saved order.

ErrorStatusCondition
SITE_NOT_FOUND404The site does not exist

bulkRedirects.save

PUT /sites/{id}/bulk-redirects · write

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID
redirectsbodyarray<Bulk redirect entry>yesAt most 5000; source uniqueReplaces the site's redirect table

Response: the saved Bulk redirect entry[].

ErrorStatusCondition
SITE_NOT_FOUND404The site does not exist
BULK_REDIRECT_HOST_UNKNOWN400The host of a host/path source is neither an exact domain of the site nor one label under a wildcard domain of the site; data.hosts holds the first 5, comma-separated

IP lists

  • Lists apply to every cluster: creating, changing and deleting one publishes a configuration revision for every cluster (reason rules_updated) and audits ip_list.create, ip_list.update (metadata: the entry count entries, kind) and ip_list.delete.
  • Quota: at most 128 lists and 50000 entries in all; a change that does not add entries always fits.
  • Behavior: IP lists.
ProcedureMethod and pathAccess
ipLists.listGET /ip-listsread
ipLists.createPOST /ip-listswrite
ipLists.updatePUT /ip-lists/{id}write
ipLists.deleteDELETE /ip-lists/{id}write

ipLists.list

GET /ip-lists · read

No parameters.

Response: IP list[], sorted by name.

ipLists.create

POST /ip-lists · write

ParameterInTypeRequiredConstraints and defaultDescription
namebodystringyesStarts with a letter or underscore, only letters, digits and underscores, 1–64 charactersName, written $name in expressions; cannot be changed later
entriesbodyarray<string>yesAt most 10000 IPv4 / IPv6 addresses or CIDRs of at most 64 characters eachStored with host bits cleared, deduplicated and sorted; an invalid entry fails validation
kindbodyenumnocollection / allow / block, default collectioncollection: referenced by rules; block: a block list for every site; allow: an allow list for every site

Response: IP list.

ErrorStatusCondition
IP_LIST_NAME_TAKEN409The name is in use
IP_LIST_LIMIT409The list or entry quota would be exceeded

ipLists.update

PUT /ip-lists/{id} · write

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—List ID
entriesbodyarray<string>yesAs for ipLists.createReplaces all entries
kindbodyenumyescollection / allow / blockThe list's action

Response: IP list.

ErrorStatusCondition
IP_LIST_NOT_FOUND404The list does not exist
IP_LIST_LIMIT409The change adds entries and exceeds the entry quota

ipLists.delete

DELETE /ip-lists/{id} · write

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—List ID

Response: { ok: true }.

ErrorStatusCondition
IP_LIST_NOT_FOUND404The list does not exist
IP_LIST_IN_USE409Rules, cache rule conditions or L4 applications still refer to the list, or sites chose it as a site list; data.users holds the first 5 users, comma-separated (site rules as rule name (site name))

IP check

What the console knows about an address: the IP lists that contain it, the active bans that cover it, and how each cluster's client address setting sees it; for a site, also the outcome of the edge's list and ban steps. GeoIP is not looked up. Behavior: IP check.

ProcedureMethod and pathAccess
ipCheck.checkGET /ip-checkread

ipCheck.check

GET /ip-check · read

ParameterInTypeRequiredConstraints and defaultDescription
ipquerystringyes1–64 characters after trimming; an IPv4 or IPv6 address, not a CIDRThe address to check
siteIdqueryuuidno—Site ID; with it, bans holds only platform bans and the site's, clusters only the site's cluster, and verdict is computed

Response: IP check result.

ErrorStatusCondition
IP_ADDRESS_INVALID400ip is not an IP address, or is a CIDR
SITE_NOT_FOUND404The site of siteId does not exist

Bans

  • Bans reach the nodes over the node channel within seconds, without a configuration revision. Audit: ban.create, ban.update (banning an active manual ban again), ban.delete.
  • Active manual bans and greylist entries together stay within the platform limit (maxTotal of settings.bans, default 10000).
  • Behavior: Bans.
ProcedureMethod and pathAccess
bans.listGET /bansread
bans.createPOST /banswrite
bans.deleteDELETE /bans/{id}write

bans.list

GET /bans · read

Active bans only (neither expired nor lifted), newest first.

ParameterInTypeRequiredConstraints and defaultDescription
scopequeryenumnosite / platformScope
siteIdqueryuuidno—Only the site's bans; the site's existence is not checked
sourcequeryenumnomanual / auto / ruleSource
addressquerystringno1–64 characters after trimming; an IP address or a CIDR of any prefix lengthOnly bans that cover it or lie inside it
pagequeryintegerno≥1, default 1Page
pageSizequeryintegerno1–100, default 50Items per page

Response: { items: [Ban](#ban-object)[], total }.

ErrorStatusCondition
BAN_INVALID_CIDR400address is not an IP address or CIDR

bans.create

POST /bans · write

ParameterInTypeRequiredConstraints and defaultDescription
scopebodyenumyessite / platformsite: one site; platform: every site of every cluster
siteIdbodyuuidconditionalRequired when scope is site, not allowed when it is platformSite ID
cidrbodystringyes1–64 characters after trimming; an IP address or CIDR with a prefix of at least /16 (IPv4) or /48 (IPv6)Stored with host bits cleared, IPv6 lowercase and compressed, IPv4-mapped addresses as IPv4
reasonbodyenumyesabuse / attack / scanner / spam / otherReason
durationSecondsbodyintegeryes60–604800Duration in seconds

When an active manual ban of the same scope, site and CIDR exists, its reason and expiry are updated and the same id is returned; it does not count against the limit and is audited ban.update. An automatic or rule ban of the same CIDR at platform scope is replaced by this manual ban.

Response: Ban.

ErrorStatusCondition
BAN_INVALID_CIDR400cidr is not an IP address or CIDR
BAN_PREFIX_TOO_SHORT400The prefix is shorter than /16 (IPv4) or /48 (IPv6); data.min
BAN_EXPIRY_OUT_OF_RANGE400durationSeconds is outside 60–604800
BAN_PROTECTED_ADDRESS400The ban covers loopback or unspecified addresses (0.0.0.0/8, 127.0.0.0/8, ::/128, ::1/128), node addresses (site ban: nodes of the site's cluster; platform ban: every node) or entries of allow lists; data.address is the conflicting address
BAN_PLATFORM_LIMIT409Active manual bans and greylist entries have reached the limit; data.limit
SITE_NOT_FOUND404The site of siteId does not exist

bans.delete

DELETE /bans/{id} · write

Lifts an active ban of any source (manual, automatic or rule).

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Ban ID

Response: { ok: true }.

ErrorStatusCondition
BAN_NOT_FOUND404The ban does not exist, has expired or was lifted

Greylist

  • Greylist entries share the bans' node channel, address rules, duration range, reasons and limit of manual entries; a ban of the same CIDR is a separate record and wins while both last.
  • Creating or updating an entry whose action is a challenge publishes the clusters it applies to (every cluster for a platform entry; reason greylist_challenge) to deliver challenge keys; clusters whose configuration already carries them get no new revision.
  • Audit: greylist.create, greylist.update, greylist.delete. Nodes need the capability greylist-v1. Behavior: Greylist.
ProcedureMethod and pathAccess
greylist.listGET /greylistread
greylist.createPOST /greylistwrite
greylist.deleteDELETE /greylist/{id}write

greylist.list

GET /greylist · read

Active entries only, newest first.

ParameterInTypeRequiredConstraints and defaultDescription
scopequeryenumnosite / platformScope
siteIdqueryuuidno—Only the site's entries
addressquerystringno1–64 characters after trimming; an IP address or CIDROnly entries that cover it or lie inside it
pagequeryintegerno≥1, default 1Page
pageSizequeryintegerno1–100, default 50Items per page

Response: { items: [Greylist entry](#greylist-entry-object)[], total, unsupportedNodes }; unsupportedNodes counts the active nodes (of every cluster) without greylist-v1, which ignore every entry.

ErrorStatusCondition
BAN_INVALID_CIDR400address is not an IP address or CIDR

greylist.create

POST /greylist · write

ParameterInTypeRequiredConstraints and defaultDescription
scopebodyenumyessite / platformScope
siteIdbodyuuidconditionalRequired when scope is site, not allowed when it is platformSite ID
cidrbodystringyesAs for bans.createIP address or CIDR
reasonbodyenumyesabuse / attack / scanner / spam / otherReason
durationSecondsbodyintegeryes60–604800Duration in seconds
actionbodyobjectyesSee Greylist entry object{ kind: "challenge", challenge } or { kind: "rate_limit", requests, windowSeconds }

When an active entry of the same scope, site and CIDR exists, its action, reason and expiry are updated and the same id is returned; it does not count against the limit and is audited greylist.update.

Response: Greylist entry.

ErrorStatusCondition
BAN_INVALID_CIDR400cidr is not an IP address or CIDR
BAN_PREFIX_TOO_SHORT400The prefix is shorter than /16 (IPv4) or /48 (IPv6); data.min
BAN_EXPIRY_OUT_OF_RANGE400durationSeconds is outside 60–604800
BAN_PROTECTED_ADDRESS400The entry covers a protected address, as for bans.create; data.address
BAN_PLATFORM_LIMIT409Active manual bans and greylist entries have reached the limit; data.limit
SITE_NOT_FOUND404The site of siteId does not exist

greylist.delete

DELETE /greylist/{id} · write

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Entry ID

Response: { ok: true }.

ErrorStatusCondition
BAN_NOT_FOUND404The entry does not exist, has expired or was removed

Challenges and CC mitigation

  • Challenge types are also levels, weakest first: cookie302, js, pow, captcha; CC levels add normal.
  • A change publishes a configuration revision for the site's cluster (reason site_protection_updated) and audits site.protection_update (metadata from, to, revision).
  • Node capabilities: Under Attack and CC need challenge-v1; allowVerifiedBots, challengeText and failureBan need challenge-v2; logJa4 needs ja4-v1.
  • Platform Under Attack and the CC template are system settings (settings.protection, settings.ccTemplate). Behavior: Challenges and CC mitigation.
ProcedureMethod and pathAccess
protection.getGET /sites/{id}/protectionread
protection.updatePATCH /sites/{id}/protectionwrite
security.stateGET /sites/{id}/securityread
security.eventsGET /sites/{id}/security/eventsread

protection.get

GET /sites/{id}/protection · read

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID

Response: Site protection. A site never saved returns the defaults with updatedAt null.

ErrorStatusCondition
SITE_NOT_FOUND404The site does not exist

protection.update

PATCH /sites/{id}/protection · write

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID
underAttackbodybooleannoUnchanged when omittedThe site's Under Attack
underAttackChallengebodyenumnocookie302 / js / pow / captcha; unchanged when omittedChallenge type of Under Attack
passTtlSecondsbodyintegerno300–86400; unchanged when omittedPass lifetime in seconds
powDifficultybodyintegerno8–24; unchanged when omittedProof-of-work difficulty (leading zero bits)
powHighDifficultybodyintegerno8–26, at least powDifficulty after merging; unchanged when omittedHigh-difficulty proof of work
ccbodyobjectnoAny fields of CC thresholds, plus enabled and followTemplate (boolean); unchanged when omittedMerged into the saved CC policy
logJa4bodybooleannoUnchanged when omittedRecord JA4 in sampled access logs
allowVerifiedBotsbodybooleannoUnchanged when omittedVerified search engine crawlers skip Under Attack and CC challenges
challengeTextbodyobjectnotitleZh, hintZh, titleEn, hintEn, each at most 200 characters after trimming, no control characters; an omitted subfield is ""; unchanged when omittedReplaces the challenge pages' title and hint; "" is the built-in text
failureBanbodyobjectno{ enabled, threshold, banSeconds }, all required: threshold 3–100, banSeconds 60–86400; unchanged when omittedAfter threshold challenge failures within 10 minutes, ban the address for banSeconds
  • With cc.followTemplate true the thresholds are the platform CC template's; threshold fields sent along are saved but not used.
  • Sending underAttack counts as a manual change: while automatic mitigation holds Under Attack on the site, turning it on takes it over and turning it off ends the hold and pauses automatic mitigation.

Response: Site protection.

ErrorStatusCondition
SITE_NOT_FOUND404The site does not exist
PROTECTION_POW_DIFFICULTY400After merging, powHighDifficulty is below powDifficulty; data.min is the lowest allowed value

security.state

GET /sites/{id}/security · read

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID
hoursqueryintegerno1–720, default 24Hours topIps and topPaths cover

Response:

FieldTypeDescription
nodesarray<object>Each active node of the site's cluster, sorted by name
nodes[].id, nodes[].nameuuid, stringThe node
nodes[].onlinebooleanWhether the node is online
nodes[].levelenumThe site's CC level on the node: normal / cookie302 / js / pow / captcha; normal when not reported
nodes[].escalatedPathsintegerPaths challenged above the site's level
nodes[].reportedAtdatetime or nullWhen the node last connected
topIps, topPathsarray<{ value, count }>Heaviest addresses and paths of the security events in the last hours, at most 10 each, approximate
hoursintegerThe hours used
ErrorStatusCondition
SITE_NOT_FOUND404The site does not exist

security.events

GET /sites/{id}/security/events · read

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID
kindqueryenumnosite_level / path_level / ip_bannedEvent kind
hoursqueryintegerno1–720; no limit when omittedOnly events of the last this many hours
pagequeryintegerno≥1, default 1Page
pageSizequeryintegerno1–100, default 50Items per page

Response: { items: [Security event](#security-event-object)[], total }, newest first. Events are kept for eventRetentionDays of the system setting settings.protection.

ErrorStatusCondition
SITE_NOT_FOUND404The site does not exist

Managed challenge and CAPTCHA providers

FieldNotes
underAttackChallengeSite and global also accept managed (managed challenge); CC levels and the greylist do not
interactiveProviderPATCH /sites/{id}/protection: global (default, follows the global provider), builtin (built-in image captcha), site (the site's provider)
providerThe site's provider in PATCH /sites/{id}/protection, the global one in PUT /settings/protection: kind (builtin, turnstile, recaptcha_v2, recaptcha_v3, recaptcha_enterprise, tencent, aliyun, geetest), siteKey (1–128 letters, digits, _.-; required except for builtin), minScore (1–100, default 50; recaptcha_v3 and recaptcha_enterprise), projectId (required for recaptcha_enterprise), region (cn / sgp) and prefix (aliyun, prefix required), secret (see below; fields left out keep the saved values of the same kind)
Responsesprotection.* add interactiveProvider, provider, globalProvider; settings.protection adds provider: { kind, siteKey, minScore, projectId, region, prefix, secretSet, updatedAt }, never the secrets
kindsecret fields
turnstile, recaptcha_v2, recaptcha_v3secret
recaptcha_enterpriseapiKey
tencentsecretId, secretKey, appSecretKey
aliyunaccessKeyId, accessKeySecret
geetestcaptchaKey
Error codeStatusWhen
CHALLENGE_PROVIDER_SECRET_REQUIRED400A new provider, or a switch to site, without all secret fields; data.fields lists the missing ones

The managed challenge, interactiveProvider site, and a global provider other than builtin need the node capability challenge-v3. A change of the global provider publishes the clusters with sites that follow it (platform_protection_updated) and is audited as system.protection_update without the secrets.

curl -fsS -X PATCH -H "x-api-key: $EDGEWEIR_API_KEY" -H 'content-type: application/json' \
  -d '{"interactiveProvider":"site","provider":{"kind":"turnstile","siteKey":"<site key>","secret":{"secret":"<secret key>"}}}' \
  https://cdn-admin.example.com/api/v1/sites/<site ID>/protection

OWASP CRS

  • A change publishes a configuration revision for the site's cluster (reason site_waf_updated) and audits site.waf_update (metadata from, to, revision).
  • Node capabilities: turning CRS on needs modsecurity-v1; exclusions with path or targets need waf-v2.
  • Behavior: OWASP CRS managed rules.
ProcedureMethod and pathAccess
waf.getGET /sites/{id}/wafread
waf.updatePATCH /sites/{id}/wafwrite
waf.topRulesGET /sites/{id}/waf/rulesread

waf.get

GET /sites/{id}/waf · read

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID

Response: Site CRS. Never saved: the defaults mode off, paranoiaLevel 1, anomalyThreshold 5, exclusions [], requestBodyLimit 131072, with updatedAt null.

ErrorStatusCondition
SITE_NOT_FOUND404The site does not exist

waf.update

PATCH /sites/{id}/waf · write

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID
modebodyenumnooff / detect / block; unchanged when omitteddetect logs matches only; block answers 403 once the anomaly score reaches the threshold
paranoiaLevelbodyintegerno1–4; unchanged when omittedParanoia level
anomalyThresholdbodyintegerno1–1000; unchanged when omittedInbound anomaly score threshold
exclusionsbodyarray<CRS exclusion>noAt most 100; unchanged when omittedReplaces every exclusion
requestBodyLimitbodyintegerno0–134217728; unchanged when omittedRequest body bytes inspected; 0 inspects no body

Response: Site CRS.

ErrorStatusCondition
WAF_RULE_NOT_EXCLUDABLE400ruleIds contains setup or evaluation rules (901xxx, 949xxx, 959xxx, 980xxx); data.ids holds the first 5, comma-separated
SITE_NOT_FOUND404The site does not exist

waf.topRules

GET /sites/{id}/waf/rules · read

ParameterInTypeRequiredConstraints and defaultDescription
idpathuuidyes—Site ID
rangequeryenumno1h / 6h / 24h / 7d / 30d, default 24hTime range
limitqueryintegerno1–50, default 10Rules returned

Response: { approximate: true, items: [{ ruleId, requests }] }, most matched first, approximate; detection rules only, without 901xxx, 949xxx, 959xxx and 980xxx.

ErrorStatusCondition
SITE_NOT_FOUND404The site does not exist

Objects

Rule object

In requests id may be omitted; omitted fields take their defaults, and responses carry every field.

FieldTypeDescription
iduuidRule ID; optional in requests
namestring1–100 characters after trimming
phaseenumrequest-transform, redirect, config, waf-custom, ratelimit, cache, origin, response-transform, compression
expressionstringCondition expression, 1–4096 characters, parsed for phase; syntax: Expressions
enabledbooleanDefault false: a rule saved without it is disabled
actionobjectA rule action, told apart by kind; kind must be available in the phase

An invalid expression or value expression returns 400 BAD_REQUEST; the issue's params.expressionError in data.issues is { code, position, params }, as in the result of rules.validate.

Rule actions

kindPhasesFieldsNode capability
blockwaf-customstatusCode: 403 (default) or 451—
logwaf-customaccessLog: boolean, optional; write an access log line whatever the sample rateaccessLog: waf-v2
allowwaf-customNone—
challengewaf-customtype: cookie302 / js (default) / pow / captcha; requests without a pass of this level or higher get the challengechallenge-v1
banwaf-customSee banwaf-v2
respondwaf-customSee respondwaf-v2
closewaf-customNone; closes the connection without a responsewaf-v2
skipwaf-customskip: 1–4 unique values of rules, rate_limits, crs, challengeswaf-v2
redirectredirectSee redirectSee that section
rewriterequest-transformSee rewriteSee that section
request_headerrequest-transform, originSee request_header and response_headerSee that section
response_headerresponse-transformSee request_header and response_headerSee that section
configconfig, cacheSee configSee that section
originoriginSee originrules-v2
compressioncompressionalgorithms: unique values of zstd, br, gzip in preference order; [] disables compressionrules-v2
rate_limitratelimitSee rate_limitSee that section

Targets of skip: rules, the remaining custom WAF rules of the rule's scope; rate_limits, rate limits (platform rules skip all of them, site rules only the site's); crs, OWASP CRS; challenges, Under Attack and CC challenges. Action behavior: WAF actions and Action fields; what needs which capability: Node capabilities and publishing.

ban

Bans ip.src, masked to the prefix (source rule, reason waf_rule), and answers this request with 403.

FieldTypeDescription
banSecondsinteger60–604800, default 3600
banScopeenumsite (default) / platform; platform for platform rules only
banPrefixV4integer16–32, default 32
banPrefixV6integer48–64, default 64

respond

Ends the request with a status and a static body, or with the site's error page of the status; the response carries Cache-Control: no-store.

FieldTypeDescription
statusCodeinteger200, 204 or 400–599, default 403
contentTypeenumtext/plain (default) / text/html / application/json
bodystringAt most 8192 bytes, no control characters but tab and line breaks, default ""; must be empty when statusCode is 204 or errorPage is true
errorPagebooleanDefault false; for 4xx and 5xx only

redirect

Set exactly one of value and target.

FieldTypeDescription
valuestringStatic target, default "": a local path with a single leading /, or an http(s) URL without credentials, whitespace or backslashes; at most 4096 characters, no control characters
targetstringValue expression computing the target per request, at most 4096 characters, default "" (rules-v2)
statusCodeinteger301 (default), 302, 303, 307, 308; 303 needs rules-v3
preserveQuerybooleanDefault false; appends the request's query string to the target
setQueryarray<object>At most 16 query parameters, names unique, default []; set after removing parameters of the same name (rules-v2)
removeQueryarray<string>At most 16 parameter names ([A-Za-z0-9._~-]{1,64}), none also in setQuery, default [] (rules-v2)

rewrite

Rewrites the path and query string sent to the origin. Fields as for redirect, without statusCode; value is a path with a single leading / and no ?, # or backslash; preserveQuery defaults to true, and false clears the query string before setQuery and removeQuery apply.

Query parameter

FieldTypeDescription
namestring[A-Za-z0-9._~-]{1,64}
valuestringPrintable ASCII, at most 256 characters; the node percent-encodes it
expressionstringValue expression, at most 4096 characters, default "" (rules-v3); value must be empty when it is set

request_header and response_header

FieldTypeDescription
headerstring1–64 token characters, lowercased; not host, authorization, proxy-authorization, cookie, set-cookie, content-length, transfer-encoding, connection, upgrade, te, trailer or cdn-loop, and not starting with x-edgeweir-
valuestringStatic value, at most 4096 characters, no control characters, default ""
expressionstringValue expression, at most 4096 characters, default "" (rules-v3); when set, value must be empty and remove false
removebooleanDefault false; removes the header
appendbooleanresponse_header only; default false, adds another line next to the response's own header of that name (rules-v3); cannot be true together with remove

config

Overrides site settings for the requests the rule matches; later matching rules override field by field. Every field is optional and an omitted one is not overridden; set at least one. The cache phase accepts only cacheBypass, forceHttps and gzip.

FieldTypeDescription
cacheBypassbooleanBypass the cache
forceHttpsbooleanForce HTTPS
gzipbooleanGzip (among the codings the site enables)
brotli, zstdbooleanconfig phase only (rules-v2)
websocketbooleanconfig phase only (rules-v2)
underAttackbooleanThe site's Under Attack; platform Under Attack is unaffected; config phase only (rules-v2)
ccEnabledbooleanCC escalation; requests are counted either way; config phase only (rules-v2)
ccMaxLevelenumcookie302 / js / pow / captcha; config phase only (rules-v2)
originConnectTimeoutMsinteger100–120000; config phase only (rules-v2)
originSendTimeoutMs, originReadTimeoutMsinteger100–3600000; config phase only (rules-v2)
logSampleRateintegerAccess log sample rate, 0–10000 basis points (0 stops sampling); config phase only (rules-v2)
requestBodyLimitintegerRequest body limit by Content-Length in bytes, 0–10737418240, 0 for none; config phase only (site-content-v1)
crsenumThe request's CRS mode: off / detect / block; sites without CRS ignore it; config phase only (waf-v2)

origin

Set at least one override.

FieldTypeDescription
originGroupstringOne of the site's origin groups, "" (default) for the default group; otherwise [a-z0-9_-]{1,32} and an existing group of the site; platform rules only ""
hostHeaderstringHost header sent upstream, trimmed, ASCII letters lowercased, at most 259 characters, default "" (not overridden); a host name or IP with an optional port, IPv6 in brackets when it has a port
snistringTLS SNI host name, lowercased, at most 253 characters, default "" (not overridden)
portinteger0–65535, default 0 (not overridden); applies to every origin of the group

rate_limit

FieldTypeDescription
statusCodeinteger429 (default) or 403
limitinteger1–100000, required
windowSecondsinteger1–3600, required
keystringCounting key, default ip.src: ip.src, http.host, tls.ja4 (ja4-v1) or http.request.headers.<name> (name [a-z0-9-]{1,64})
banSecondsintegerOptional; 0 is off, or 60–86400: ban the address over the limit at site scope (IPv4 /32, IPv6 /64, source rule, reason rate_limit) for this long (waf-v2)

Rule version object

FieldTypeDescription
ruleIduuidRule ID
versionintegerVersion number, rising from 1 per rule
changeenumcreated / updated / deleted
sourceenumui (console session), api (AccessKey or service account), restore, copy (copied settings), initial (rules that existed before the upgrade)
restoredFrominteger or nullThe version a restore brought back
ruleobjectThe rule as saved, { name, phase, expression, enabled, action }; for deleted, the content before deletion. Checked against today's rules only on restore
actorobject{ type, id, name }: who saved
createdAtdatetimeWhen it was recorded

Bulk redirect entry

FieldTypeDescription
sourcestring/path (every domain of the site) or host/path (that domain only, lowercase host); 2–512 bytes without whitespace, ? or control characters
targetstringStatic redirect target: a local path with a single leading /, or an http(s) URL without credentials, whitespace or backslashes; at most 1024 bytes
statusCodeinteger301 (default), 302, 307, 308
preserveQuerybooleanDefault false; appends the request's query string to the target

IP list object

FieldTypeDescription
iduuidList ID
namestringName
entriesarray<string>Canonical addresses and CIDRs, sorted
kindenumcollection / allow / block

IP check result

FieldTypeDescription
ipstringThe address as nodes read it (IPv4-mapped IPv6 as IPv4)
siteobject or null{ id, name }; null without siteId
listsarray<object>Lists that contain the address, sorted by name
lists[].id, lists[].name, lists[].kinduuid, string, enumThe list
lists[].entriesarray<string>The entries that contain the address
lists[].siteRoleenum or nullWith siteId: the list is the site's site block list (block) or site allow list (allow); otherwise null
bansarray<Ban>Active bans that cover the address, at most 100
clustersarray<object>Clusters, sorted by name
clusters[].id, clusters[].nameuuid, stringThe cluster
clusters[].clientIpenumClient address mode: direct / proxy_protocol / header
clusters[].trustedProxybooleanIn header mode, the address is a trusted proxy
clusters[].nodeAddressbooleanThe address is a node address of the cluster
verdictobject or nullWith siteId, { outcome, platformAllowed, siteAllowed }; otherwise null
verdict.outcomeenumThe first step of the edge that decides, in the edge's order: platform_banned, site_banned, platform_blocked, site_blocked, allowed, none
verdict.platformAllowedbooleanThe address is in an allow list
verdict.siteAllowedbooleanThe address is in a site allow list of the site

Ban object

FieldTypeDescription
iduuidBan ID
scopeenumsite / platform
cidrstringCanonical CIDR, such as 203.0.113.7/32
reasonenumManual: abuse, attack, scanner, spam, other; automatic: cc_ip_rate, unknown_host_scan, challenge_failures; rule: waf_rule, rate_limit
sourceenummanual / auto / rule
siteId, siteNameuuid, string or nullnull for platform bans
nodeobject or nullThe node that made an automatic or rule ban, { id, name }
triggerobject or null{ metric, observed, threshold, windowSeconds, ruleId? }: what triggered it; ruleId is the rule of a rule ban
ruleobject or nullThe rule of a rule ban, { id, name, platform }; name is null once the rule is deleted
createdByobject or nullWho created a manual ban, { type, id, name }
createdAt, expiresAtdatetimeCreation and expiry
seqstringPosition in the ban change sequence, a decimal string
distributedbooleanSent to the nodes; false for automatic bans not shared
unappliedNodesintegerOnline nodes that report this manual ban as not applied (no room)

Greylist entry object

FieldTypeDescription
iduuidEntry ID
scopeenumsite / platform
cidrstringCanonical CIDR
reasonenumabuse / attack / scanner / spam / other
siteId, siteNameuuid, string or nullnull for platform entries
actionobject{ kind: "challenge", challenge }: challenge is cookie302 / js / pow / captcha, and requests without a pass of that level get the challenge; or { kind: "rate_limit", requests, windowSeconds }: each client (IPv4 address, IPv6 /64) may send requests requests (1–100000) per windowSeconds (1–3600), 429 above
createdByobject or nullWho created it, { type, id, name }
createdAt, expiresAtdatetimeCreation and expiry
unappliedNodesintegerOnline nodes that report this entry as not applied (no room)

Site protection object

FieldTypeDescription
siteIduuidSite ID
underAttackbooleanThe site's Under Attack: GET / HEAD requests without a valid pass get a challenge; default false
underAttackChallengeenumDefault js
passTtlSecondsintegerDefault 1800
powDifficultyintegerDefault 16
powHighDifficultyintegerDefault 20
ccobjectThe site's CC policy: CC thresholds plus enabled (default false) and followTemplate (default true); while it follows the template the thresholds are the template's
ccTemplateobjectThe platform's current CC thresholds template
effectiveCcobject or nullThe CC thresholds the nodes use; null while the policy is off
logJa4booleanDefault false
allowVerifiedBotsbooleanDefault false
challengeTextobject{ titleZh, hintZh, titleEn, hintEn }; "" is the built-in text
failureBanobject{ enabled, threshold, banSeconds }; default { enabled: false, threshold: 10, banSeconds: 600 }, the saved values are returned while it is off
platformUnderAttackbooleanWhether platform Under Attack is on
updatedAtdatetime or nullLast saved; null when never saved

CC thresholds object

Every rate is in requests per second over a sliding window, and 0 turns its trigger off; each node decides on its own, so thresholds apply per node. The platform template's defaults are in parentheses.

FieldTypeDescription
maxLevelenumHighest level reachable: cookie302 / js / pow / captcha (captcha)
highPowInsteadOfCaptchabooleanAt the captcha level, use the high-difficulty proof of work instead (false)
windowSecondsinteger5–60 (10)
siteQpsinteger0–1000000 (1000)
urlQpsinteger0–1000000; only attacked paths are escalated (200)
ipQpsinteger0–1000000; addresses over it are banned automatically for ipBanSeconds (50)
ipBanSecondsinteger60–86400 (600)
originErrorPercentinteger0–100, origin errors (5xx and failed attempts) in percent of origin requests (50)
originErrorMinRequestsinteger0–1000000, origin requests in the window before the error rate counts (100)
escalateAfterSecondsinteger1–3600; a trigger that holds this long raises the level one step (10)
cooldownSecondsinteger1–86400; without triggers for this long the level falls one step (60)

Security event object

FieldTypeDescription
iduuidEvent ID
nodeobject or null{ id, name }; null once the node is deleted
occurredAtdatetimeWhen it happened
kindenumsite_level / path_level / ip_banned
level, previousLevelstringLevel after and before the change (site_level, path_level)
pathstringPath of a path_level event
addressstringAddress of an ip_banned event
metricstringsite_qps, url_qps, ip_qps, origin_error_rate or cooldown
observed, thresholdnumberObserved value and threshold
topIps, topPathsarray<{ value, count }>Heaviest addresses and paths when it happened

Site CRS object

FieldTypeDescription
siteIduuidSite ID
modeenumoff / detect / block
paranoiaLevelintegerParanoia level
anomalyThresholdintegerInbound anomaly score threshold
exclusionsarray<CRS exclusion>In saved order
requestBodyLimitintegerRequest body bytes inspected
updatedAtdatetime or nullLast saved

CRS exclusion

The rules do not run for the requests it matches; with targets, they only stop inspecting those targets. When saved, ruleIds are deduplicated and ascending, targets deduplicated and sorted, and exact is false when path is empty.

FieldTypeDescription
pathstring"" (default, the whole site) or a path starting with /, at most 1024 bytes, without ?, #, whitespace or control characters; matched against the normalized path (waf-v2)
exactbooleanDefault false (prefix); true for an exact match
ruleIdsarray<integer>1–200 unique CRS rule IDs (900000–999999), none of 901xxx, 949xxx, 959xxx, 980xxx
targetsarray<string>At most 16 unique targets, default []: ARGS:<name>, REQUEST_COOKIES:<name> (name of 1–64 A-Za-z0-9_.-[]) or REQUEST_HEADERS:<name> (name of 1–64 A-Za-z0-9-) (waf-v2)
Edit on GitHub

On this page