View rulesets

Last updated Apr 16, 2026 This page includes examples of the following API operations:

View available rulesets

You can list the available rulesets for a zone or account.

For a list of API endpoints refer to List and view rulesets.

Example: View available rulesets at the zone level

The response to the GET request obtaining the list of rulesets at the zone level will include the following rulesets:

  • Managed rulesets you can deploy, indicated by "kind": "managed".
  • Zone-level phase entry point rulesets, if configured, indicated by "kind": "zone".
  • Custom rulesets, if configured, indicated by "kind": "custom".

<details>

<summary>

Required API token permissions

</summary>

At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:

  • <code>Response Compression Write</code>
  • <code>Response Compression Read</code>
  • <code>Config Settings Write</code>
  • <code>Config Settings Read</code>
  • <code>Dynamic URL Redirects Write</code>
  • <code>Dynamic URL Redirects Read</code>
  • <code>Cache Settings Write</code>
  • <code>Cache Settings Read</code>
  • <code>Custom Errors Write</code>
  • <code>Custom Errors Read</code>
  • <code>Origin Write</code>
  • <code>Origin Read</code>
  • <code>Managed headers Write</code>
  • <code>Managed headers Read</code>
  • <code>Zone Transform Rules Write</code>
  • <code>Zone Transform Rules Read</code>
  • <code>Mass URL Redirects Write</code>
  • <code>Mass URL Redirects Read</code>
  • <code>Magic Firewall Write</code>
  • <code>Magic Firewall Read</code>
  • <code>L4 DDoS Managed Ruleset Write</code>
  • <code>L4 DDoS Managed Ruleset Read</code>
  • <code>HTTP DDoS Managed Ruleset Write</code>
  • <code>HTTP DDoS Managed Ruleset Read</code>
  • <code>Sanitize Write</code>
  • <code>Sanitize Read</code>
  • <code>Transform Rules Write</code>
  • <code>Transform Rules Read</code>
  • <code>Select Configuration Write</code>
  • <code>Select Configuration Read</code>
  • <code>Bot Management Write</code>
  • <code>Bot Management Read</code>
  • <code>Zone WAF Write</code>
  • <code>Zone WAF Read</code>
  • <code>Account WAF Write</code>
  • <code>Account WAF Read</code>
  • <code>Account Rulesets Read</code>
  • <code>Account Rulesets Write</code>
  • <code>Logs Write</code>
  • <code>Logs Read</code>
  • <code>Logs Write</code>
  • <code>Logs Read</code>

</details>

List zone rulesetsbash

curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/rulesets" \
    --request GET \
    --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
{
    "result": [
        {
            "id": "<ZONE_PHASE_RULESET_ID>",
            "name": "Zone-level Ruleset 1",
            "description": "Ruleset for http_request_firewall_managed phase at the zone level",
            "kind": "zone",
            "version": "2",
            "last_updated": "2021-03-12T14:11:59.754817Z",
            "phase": "http_request_firewall_managed"
        },
        {
            "id": "<CLOUDFLARE_MANAGED_RULESET_ID>",
            "name": "Cloudflare Managed Ruleset",
            "description": "Created by the Cloudflare security team, this ruleset is designed to provide fast and effective protection for all your applications. It is frequently updated to cover new vulnerabilities and reduce false positives",
            "kind": "managed",
            "version": "2",
            "last_updated": "2021-03-18T14:42:40.972022Z",
            "phase": "http_request_firewall_managed"
        },
        {
            "id": "<CLOUDFLARE_OWASP_CORE_RULESET_ID>",
            "name": "Cloudflare OWASP Core Ruleset",
            "description": "Cloudflare's implementation of the Open Web Application Security Project (OWASP) ModSecurity Core Rule Set. We routinely monitor for updates from OWASP based on the latest version available from the official code repository",
            "kind": "managed",
            "version": "3",
            "last_updated": "2021-03-18T14:42:42.993211Z",
            "phase": "http_request_firewall_managed"
        }
    ],
    "success": true,
    "errors": [],
    "messages": []
}

Example: View available rulesets at the account level

The response to the GET request obtaining the list of rulesets at the account level will include the following rulesets:

  • Managed rulesets you can deploy, indicated by "kind": "managed".
  • Account-level phase entry point rulesets, if configured, indicated by "kind": "root".
  • Custom rulesets, if configured, indicated by "kind": "custom".

<details>

<summary>

Required API token permissions

</summary>

At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:

  • <code>Mass URL Redirects Write</code>
  • <code>Mass URL Redirects Read</code>
  • <code>Magic Firewall Write</code>
  • <code>Magic Firewall Read</code>
  • <code>L4 DDoS Managed Ruleset Write</code>
  • <code>L4 DDoS Managed Ruleset Read</code>
  • <code>Transform Rules Write</code>
  • <code>Transform Rules Read</code>
  • <code>Select Configuration Write</code>
  • <code>Select Configuration Read</code>
  • <code>Account WAF Write</code>
  • <code>Account WAF Read</code>
  • <code>Account Rulesets Read</code>
  • <code>Account Rulesets Write</code>
  • <code>Logs Write</code>
  • <code>Logs Read</code>

</details>

List account rulesetsbash

curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/rulesets" \
    --request GET \
    --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"
{
    "result": [
        {
            "id": "<CUSTOM_RULESET_ID>",
            "name": "Custom Ruleset 1",
            "description": "My custom ruleset",
            "kind": "custom",
            "version": "10",
            "last_updated": "2020-11-23T11:36:24.192361Z",
            "phase": "http_request_firewall_custom"
        },
        {
            "id": "<ACCOUNT_PHASE_RULESET_ID>",
            "name": "Account-level ruleset for http_request_firewall_managed phase",
            "description": "Account-level ruleset for executing one or more Managed Rulesets",
            "kind": "root",
            "version": "2",
            "last_updated": "2021-03-12T14:06:41.323932Z",
            "phase": "http_request_firewall_managed"
        },
        {
            "id": "<CLOUDFLARE_MANAGED_RULESET_ID>",
            "name": "Cloudflare Managed Ruleset",
            "description": "Created by the Cloudflare security team, this ruleset is designed to provide fast and effective protection for all your applications. It is frequently updated to cover new vulnerabilities and reduce false positives",
            "kind": "managed",
            "version": "5",
            "last_updated": "2021-03-18T14:42:40.972022Z",
            "phase": "http_request_firewall_managed"
        },
        {
            "id": "<CLOUDFLARE_OWASP_CORE_RULESET_ID>",
            "name": "Cloudflare OWASP Core Ruleset",
            "description": "Cloudflare's implementation of the Open Web Application Security Project (OWASP) ModSecurity Core Rule Set. We routinely monitor for updates from OWASP based on the latest version available from the official code repository",
            "kind": "managed",
            "version": "3",
            "last_updated": "2021-03-18T14:42:42.993211Z",
            "phase": "http_request_firewall_managed"
        }
    ],
    "success": true,
    "errors": [],
    "messages": []
}

Get an entry point ruleset

You can get the definition of the entry point ruleset of a given phase at the zone or account level.

If the entry point ruleset exists, the API will return a 200 OK HTTP status code, along with the ruleset definition.

If the entry point ruleset does not exist, the API will return a 404 Not Found HTTP status code.

Example: Get an entry point ruleset at the zone level

The following GET request obtains the definition of the entry point ruleset for the http_request_firewall_managed phase at the zone level. In this case, the entry point ruleset exists and contains one rule.

<details>

<summary>

Required API token permissions

</summary>

At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:

  • <code>Response Compression Write</code>
  • <code>Response Compression Read</code>
  • <code>Config Settings Write</code>
  • <code>Config Settings Read</code>
  • <code>Dynamic URL Redirects Write</code>
  • <code>Dynamic URL Redirects Read</code>
  • <code>Cache Settings Write</code>
  • <code>Cache Settings Read</code>
  • <code>Custom Errors Write</code>
  • <code>Custom Errors Read</code>
  • <code>Origin Write</code>
  • <code>Origin Read</code>
  • <code>Managed headers Write</code>
  • <code>Managed headers Read</code>
  • <code>Zone Transform Rules Write</code>
  • <code>Zone Transform Rules Read</code>
  • <code>Mass URL Redirects Write</code>
  • <code>Mass URL Redirects Read</code>
  • <code>Magic Firewall Write</code>
  • <code>Magic Firewall Read</code>
  • <code>L4 DDoS Managed Ruleset Write</code>
  • <code>L4 DDoS Managed Ruleset Read</code>
  • <code>HTTP DDoS Managed Ruleset Write</code>
  • <code>HTTP DDoS Managed Ruleset Read</code>
  • <code>Sanitize Write</code>
  • <code>Sanitize Read</code>
  • <code>Transform Rules Write</code>
  • <code>Transform Rules Read</code>
  • <code>Select Configuration Write</code>
  • <code>Select Configuration Read</code>
  • <code>Bot Management Write</code>
  • <code>Bot Management Read</code>
  • <code>Zone WAF Write</code>
  • <code>Zone WAF Read</code>
  • <code>Account WAF Write</code>
  • <code>Account WAF Read</code>
  • <code>Account Rulesets Read</code>
  • <code>Account Rulesets Write</code>
  • <code>Logs Write</code>
  • <code>Logs Read</code>
  • <code>Logs Write</code>
  • <code>Logs Read</code>

</details>

Get a zone entry point rulesetbash

curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/rulesets/phases/http_request_firewall_managed/entrypoint" \
    --request GET \
    --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"