To deploy a ruleset, create a rule with "action": "execute" that executes the ruleset, and add the ruleset ID to the action_parameters field in the id parameter.
The following example deploys a Managed Ruleset to the zone-level http_request_firewall_managed phase of a zone (<ZONE_ID>).Request
curl -X PUT \
-H "Authorization: Bearer <API_TOKEN>" \
-d '{
"rules":[
{
"action":"execute",
"action_parameters":{
"id":"<MANAGED_RULESET_ID>"
},
"expression":"true",
"description":"Execute Cloudflare Managed Ruleset on my phase entry point"
}
]
}'
Response
{
"result":{
"id":"<ZONE_PHASE_RULESET_ID>",
"name":"Zone-level phase entry point",
"description":"",
"kind":"zone",
"version":"4",
"rules":[
{
"id":"<RULE_ID_1>",
"version":"1",
"action":"execute",
"action_parameters":{
"id":"<MANAGED_RULESET_ID>",
"version":"latest"
},
"expression":"true",
"description":"Execute Cloudflare Managed Ruleset on my phase entry point",
"last_updated":"2021-03-21T11:02:08.769537Z",
"ref":"<RULE_REF_1>",
"enabled":true
}
],
"last_updated":"2021-03-21T11:02:08.769537Z",
"phase":"http_request_firewall_managed"
},
"success":true,
"errors":[],
"messages":[]
}
For more information on deploying rulesets, check Deploy rulesets.