Deploy a managed ruleset with ruleset, tag, and rule overrides
Customize the execution of managed rulesets with a combination of ruleset overrides, tag overrides, and rule overrides in your phase entry point ruleset.
- Add a rule to a phase entry point ruleset to execute a managed ruleset.
- Configure a ruleset override that disables all rules in the managed ruleset.
- Configure a tag override that sets an action for rules with a given tag.
- Configure a rule override that sets an action for the rules you want to execute.
The request below uses the Update a zone entry point ruleset operation to execute the following in a single PUT request:
- Add a rule to the
http_request_firewall_managedphase entry point ruleset that executes a managed ruleset. - Use category overrides to enable rules with
wordpressanddrupaltags and set their actions tolog. - Add a rule override that enables a single rule.
Example: Execute a managed ruleset at the zone level with overrides
In this example:
"id": "<MANAGED_RULESET_ID>"defines the managed ruleset to execute for requests addressed to a zone ($ZONE_ID)."enabled": falsedefines an override at the ruleset level to disable all rules in the managed ruleset."categories": [{"category": "wordpress", "action": "log", "enabled": true}, {"category": "drupal", "action": "log", "enabled": true}]defines an override at the tag level to enable rules tagged withwordpressordrupaland sets their action tolog."rules": [{"id": "<RULE_ID>", "action": "block", "enabled": true}]defines an override at the rule level that enables one individual rule and sets the action toblock.
Required API token permissions
At least one of the following token permissions
is required:
Response Compression WriteConfig Settings WriteDynamic URL Redirects WriteCache Settings WriteCustom Errors WriteOrigin WriteManaged headers WriteZone Transform Rules WriteMass URL Redirects WriteMagic Firewall WriteL4 DDoS Managed Ruleset WriteHTTP DDoS Managed Ruleset WriteSanitize WriteTransform Rules WriteSelect Configuration WriteBot Management WriteZone WAF WriteAccount WAF WriteAccount Rulesets WriteLogs WriteLogs Write
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/rulesets/phases/http_request_firewall_managed/entrypoint" \ --request PUT \ --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ --json '{ "rules": [ { "action": "execute", "expression": "true", "action_parameters": { "id": "<MANAGED_RULESET_ID>", "overrides": { "enabled": false, "categories": [ { "category": "wordpress", "action": "log", "enabled": true }, { "category": "drupal", "action": "log", "enabled": true } ], "rules": [ { "id": "<RULE_ID>", "action": "block", "enabled": true } ] } } } ] }'Example: Execute a managed ruleset at the account level with overrides
In this example:
"id": "<MANAGED_RULESET_ID>"defines the managed ruleset to execute for requests addressed toexample.com."enabled": falsedefines an override at the ruleset level to disable all rules in the managed ruleset."categories": [{"category": "wordpress", "action": "log", "enabled": true}, {"category": "drupal", "action": "log", "enabled": true}]defines an override at the tag level to enable rules tagged withwordpressordrupaland sets their action tolog."rules": [{"id": "<RULE_ID>", "action": "block", "enabled": true}]defines an override at the rule level that enables one individual rule and sets the action toblock.
Required API token permissions
At least one of the following token permissions
is required:
Mass URL Redirects WriteMagic Firewall WriteL4 DDoS Managed Ruleset WriteTransform Rules WriteSelect Configuration WriteAccount WAF WriteAccount Rulesets WriteLogs Write
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/rulesets/phases/http_request_firewall_managed/entrypoint" \ --request PUT \ --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ --json '{ "rules": [ { "action": "execute", "expression": "cf.zone.name eq \"example.com\" and cf.zone.plan eq \"ENT\"", "action_parameters": { "id": "<MANAGED_RULESET_ID>", "overrides": { "enabled": false, "categories": [ { "category": "wordpress", "action": "log", "enabled": true }, { "category": "drupal", "action": "log", "enabled": true } ], "rules": [ { "id": "<RULE_ID>", "action": "block", "enabled": true } ] } } } ] }'Was this helpful?
- Resources
- API
- New to Cloudflare?
- Directory
- Sponsorships
- Open Source
- Support
- Help Center
- System Status
- Compliance
- GDPR
- Company
- cloudflare.com
- Our team
- Careers
- © 2025 Cloudflare, Inc.
- Privacy Policy
- Terms of Use
- Report Security Issues
- Trademark