POST example
Create Ruleset
POST accounts/{account_id}/rulesets
Creates a new ruleset.
The following parameters are required.
Name | Description | Value | Notes |
---|---|---|---|
name | A human-readable name for the ruleset. | String | The name is immutable. You cannot change it over the lifetime of the ruleset. |
description | Optional description for the ruleset. | String | You can change the description over the lifetime of the ruleset. |
kind | The kind of ruleset the JSON object represents | String | Allowed values:
You can only create one root ruleset for your account. |
Use the rules
parameter to supply a list of rules that define the ruleset. For an object definition, see Rulesets API: JSON Objects.
Request
curl -X POST \"https://api.cloudflare.com/client/v4/accounts/{account_id}/rulesets" --data '{ "name": "Example ruleset", "kind": "root", "description": "Example ruleset description", "rules": [ { "action": "log", "expression": "cf.zone.name eq \"example.com\"" }]}'
Response
{ "result": { "id": "{ruleset_id}", "name": "Example ruleset", "description": "Example ruleset description", "kind": "root", "version": "1", "rules": [ { "id": "{rule_id}", "version": "1", "action": "log", "expression": "cf.zone.name eq \"example.com\"", "last_updated": "2020-07-17T15:42:37.917815Z" } ], "last_updated": "2020-07-17T15:42:37.917815Z", }, "success": true, "errors": [], "messages": []}