Create ruleset
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:
Operation | Method + Endpoint |
---|---|
Create an account ruleset | POST /accounts/{account_id}/rulesets |
Create a zone ruleset | POST /zones/{zone_id}/rulesets |
The following parameters are required:
name
String- A human-readable name for the ruleset.
- The name is immutable. You cannot change it over the lifetime of the ruleset.
description
String- Optional description for the ruleset.
- You can change the description over the lifetime of the ruleset.
kind
String- 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
phase
String- The name of the phase where the ruleset will be created.
- Check the specific Cloudflare product documentation for more information on the phases where you can create rulesets for that product.
Use the rules
parameter to supply a list of rules for the ruleset. For an object definition, refer to Rulesets API: JSON Object.
The following POST
request creates a custom ruleset in the http_request_firewall_custom
phase containing a single rule.
The following POST
request creates a zone-level phase entry point ruleset at the http_request_firewall_managed
phase with a single rule that executes a managed ruleset.
The following POST
request creates an account-level phase entry point ruleset for the http_ratelimit
phase with a single rule that executes a rate limiting ruleset for all Enterprise zones in the account.