GET examples (2)
Last updated Apr 24, 2026
Get all rules
This example returns all the firewall rules in the zone with ID {zone_id}.
Requestbash
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/firewall/rules" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>"
Responsejson
{
"result": [
{
"id": "<RULE_ID_1>",
"paused": false,
"description": "allow API traffic without challenge",
"action": "allow",
"priority": null,
"filter": {
"id": "<FILTER_ID_1>",
"expression": "http.request.uri.path matches \"^/api/.*$\"",
"paused": false,
"description": "/api"
}
},
{
"id": "<RULE_ID_2>",
"paused": false,
"description": "do not challenge login from office",
"action": "allow",
"priority": null,
"filter": {
"id": "<FILTER_ID_2>",
"expression": "ip.src in {2400:cb00::/32 2803:f800::/32 2c0f:f248::/32 2a06:98c0::/29} and (http.request.uri.path ~ \"^.*/wp-login.php$\" or http.request.uri.path ~ \"^.*/xmlrpc.php$\")",
"paused": false,
"description": "Login from office"
}
},
{
"id": "<RULE_ID_3>",
"paused": false,
"description": "challenge login",
"action": "challenge",
"priority": null,
"filter": {
"id": "<FILTER_ID_3>",
"expression": "(http.request.uri.path ~ \"^.*/wp-login.php$\" or http.request.uri.path ~ \"^.*/xmlrpc.php$\")",
"paused": false,
"description": "Login"
}
},
{
"id": "<RULE_ID_4>",
"paused": false,
"description": "Non-interactive challenge site",
"action": "js_challenge",
"priority": null,
"filter": {
"id": "<FILTER_ID_4>",
"expression": "not http.request.uri.path matches \"^/api/.*$\"",
"paused": false,
"description": "not /api"
}
}
],
"success": true,
"errors": [],
"messages": [],
"result_info": {
"page": 1,
"per_page": 25,
"count": 4,
"total_count": 4,
"total_pages": 1
}
}
Get rule by ID
This example returns the firewall rule with ID {rule_id}.
Requestbash
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/firewall/rules/{rule_id}" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>"
Responsejson
{
"result": {
"id": "<RULE_ID>",
"paused": false,
"description": "do not challenge login from office",
"action": "allow",
"priority": null,
"filter": {
"id": "<FILTER_ID>",
"expression": "ip.src in {2400:cb00::/32 2803:f800::/32 2c0f:f248::/32 2a06:98c0::/29} and (http.request.uri.path ~ \"^.*/wp-login.php$\" or http.request.uri.path ~ \"^.*/xmlrpc.php$\")",
"paused": false,
"description": "Login from office"
}
},
"success": true,
"errors": [],
"messages": []
}
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/firewall/api/cf-firewall-rules/get/#page","headline":"GET examples","description":"Retrieve filters or rules with GET API requests.","url":"https://developers.cloudflare.com/firewall/api/cf-firewall-rules/get/","inLanguage":"en","image":"https://developers.cloudflare.com/firewall/api/cf-firewall-rules/get/og.png?v=86a3b99deb683fef","dateModified":"2026-04-24","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Review the JSON structure for filter and rule objects. title: JSON object image: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/json-object/og.png?v=1fe0f48d265d98ee
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/firewall/llms.txt
Use this file to discover all available pages before exploring further.
Docs