Skip to content
WAF
Visit WAF on GitHub
Set theme to dark (⇧+D)

API examples of Custom Rules with the Skip action

Use the Rulesets API to configure Custom Rules via API.

The skip action supports different skip options, according to the security features or products that you wish to skip.

The following sections provide examples for the different skip rule scenarios available for Custom Firewall rules.

Take the following into account regarding the provided examples:

Skip the remaining rules in the current ruleset

This example uses the Add individual rule API operation to add a rule that skips the remaining rules in the current ruleset:

Request
curl -X POST \
"https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/rulesets/<RULESET_ID>/rules" \
-H "X-Auth-Email: <EMAIL>" \
-H "X-Auth-Key: <API_KEY>" \
-d '{
"action": "skip",
"action_parameters": {
"ruleset": "current"
},
"expression": "http.request.uri.path contains \"/skip-current-ruleset/\"",
"description": ""
}'

Skip a phase

This example uses the Add individual rule API operation to add a rule that skips the http_ratelimit phase:

Request
curl -X POST \
"https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/rulesets/<RULESET_ID>/rules" \
-H "X-Auth-Email: <EMAIL>" \
-H "X-Auth-Key: <API_KEY>" \
-d '{
"action": "skip",
"action_parameters": {
"phases": [
"http_ratelimit"
]
},
"expression": "http.request.uri.path contains \"/skip-phase/\"",
"description": ""
}'

Refer to Available skip options for the list of phases you can skip.

Skip security products

This example uses the Add individual rule API operation to add a rule that skips the Zone Lockdown and User Agent Blocking products:

Request
curl -X POST \
"https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/rulesets/<RULESET_ID>/rules" \
-H "X-Auth-Email: <EMAIL>" \
-H "X-Auth-Key: <API_KEY>" \
-d '{
"action": "skip",
"action_parameters": {
"products": [
"zoneLockdown",
"uaBlock"
]
},
"expression": "http.request.uri.path contains \"/skip-products/\"",
"description": ""
}'

Refer to Available skip options for the list of products you can skip.