Creates a ruleset of a given kind in the specified phase. Allows you to create phase entry point rulesets.
Use one of the following API endpoints:
- Create an account ruleset
POST /accounts/{account_id}/rulesets - Create a zone ruleset
POST /zones/{zone_id}/rulesets
A POST request to create a ruleset supports the following parameters in the request body:
nameString- A human-readable name for the ruleset.
- The name is immutable. You cannot change it over the lifetime of the ruleset.
descriptionStringOptional- Optional description for the ruleset.
- You can change the description over the lifetime of the ruleset.
kindString- The kind of ruleset the JSON object represents.
- Allowed values:
custom: Creates a custom rulesetroot: Creates a phase entry point ruleset at the account levelzone: Creates a phase entry point ruleset at the zone level
phaseString- The name of the phase where the ruleset will be created.
- Check the phases list or the specific Cloudflare product documentation for more information on the phases where you can create rulesets for that product.
rulesArray<Rule>Optional- A list of rules to include in the ruleset.
For additional details on these parameters, refer to JSON objects.
The following POST request creates a custom ruleset in the http_request_firewall_custom phase at the account level containing a single rule.
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"