Update or deploy a ruleset
Last updated Apr 16, 2026 Use one of the following API endpoints to update a ruleset:
- Update an account ruleset
PUT /accounts/{account_id}/rulesets/{ruleset_id} - Update an account entry point ruleset
PUT /accounts/{account_id}/rulesets/phases/{phase_name}/entrypoint - Update a zone ruleset
PUT /zones/{zone_id}/rulesets/{ruleset_id} - Update a zone entry point ruleset
PUT /zones/{zone_id}/rulesets/phases/{phase_name}/entrypoint
When updating a ruleset, you can update:
- The basic properties of a ruleset (currently only the description)
- The list of rules in a ruleset
You cannot update the name of the ruleset or its type. Do not include these fields in the data field of your PUT request.
To deploy a ruleset, add a rule with "action": "execute" to the list of rules of an entry point ruleset. Refer to Deploy a ruleset for an example.
Risk of replacing all rules
The update operations described in this page (PUT requests) replace the entire list of rules in the ruleset. If you omit existing rules from the request body, those rules will be removed. Always include every rule you want to keep in the rules array.
To add a single rule without replacing the entire list of rules in the ruleset, use one of the POST requests described in Add a rule to a ruleset instead.
Example - Set the rules of a ruleset
The following PUT request defines the list of rules of a ruleset, setting it to a single rule. You must include all the rules you want to associate with the ruleset in every request.
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>Response Compression Write</code>
- <code>Config Settings Write</code>
- <code>Dynamic URL Redirects Write</code>
- <code>Cache Settings Write</code>
- <code>Custom Errors Write</code>
- <code>Origin Write</code>
- <code>Managed headers Write</code>
- <code>Zone Transform Rules Write</code>
- <code>Mass URL Redirects Write</code>
- <code>Magic Firewall Write</code>
- <code>L4 DDoS Managed Ruleset Write</code>
- <code>HTTP DDoS Managed Ruleset Write</code>
- <code>Sanitize Write</code>
- <code>Transform Rules Write</code>
- <code>Select Configuration Write</code>
- <code>Bot Management Write</code>
- <code>Zone WAF Write</code>
- <code>Account WAF Write</code>
- <code>Account Rulesets Write</code>
- <code>Logs Write</code>
- <code>Logs Write</code>
</details>
Update a zone rulesetbash
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/rulesets/$RULESET_ID" \
--request PUT \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"rules": [
{
"action": "execute",
"action_parameters": {
"id": "<MANAGED_RULESET_ID>"
},
"expression": "true"
}
]
}'
{
"result": {
"id": "<RULESET_ID>",
"name": "Zone-level phase entry point ruleset",
"description": "This ruleset executes a managed ruleset.",
"kind": "zone",
"version": "4",
"rules": [
{
"id": "<RULE_ID>",
"version": "2",
"action": "execute",
"expression": "true",
"action_parameters": {
"id": "<MANAGED_RULESET_ID>"
},
"last_updated": "2025-03-17T15:42:37.917815Z"
}
],
"last_updated": "2025-03-17T15:42:37.917815Z",
"phase": "http_request_firewall_managed"
},
"success": true,
"errors": [],
"messages": []
}
Example - Deploy a ruleset
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 PUT request deploys a managed ruleset to the http_request_firewall_managed phase of a zone ($ZONE_ID).
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>Response Compression Write</code>
- <code>Config Settings Write</code>
- <code>Dynamic URL Redirects Write</code>
- <code>Cache Settings Write</code>
- <code>Custom Errors Write</code>
- <code>Origin Write</code>
- <code>Managed headers Write</code>
- <code>Zone Transform Rules Write</code>
- <code>Mass URL Redirects Write</code>
- <code>Magic Firewall Write</code>
- <code>L4 DDoS Managed Ruleset Write</code>
- <code>HTTP DDoS Managed Ruleset Write</code>
- <code>Sanitize Write</code>
- <code>Transform Rules Write</code>
- <code>Select Configuration Write</code>
- <code>Bot Management Write</code>
- <code>Zone WAF Write</code>
- <code>Account WAF Write</code>
- <code>Account Rulesets Write</code>
- <code>Logs Write</code>
- <code>Logs Write</code>
</details>
Update a zone entry point rulesetbash
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",
"action_parameters": {
"id": "<MANAGED_RULESET_ID>"
},
"expression": "true",
"description": "Execute Cloudflare Managed Ruleset on my phase entry point ruleset"
}
]
}'
{
"result": {
"id": "<RULESET_ID>",
"name": "Zone-level phase entry point ruleset",
"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 ruleset",
"last_updated": "2025-03-21T11:02:08.769537Z",
"ref": "<RULE_REF_1>",
"enabled": true
}
],
"last_updated": "2025-03-21T11:02:08.769537Z",
"phase": "http_request_firewall_managed"
},
"success": true,
"errors": [],
"messages": []
}
For more information on deploying rulesets, refer to Deploy rulesets.
Example - Update ruleset description
The following PUT request updates the description of an existing ruleset or phase entry point.
The response will include the complete ruleset definition, including all the rules.
Note
You cannot update the description or the rules in a managed ruleset. You can only define overrides to customize the ruleset behavior.
<details>
<summary>
Required API token permissions
</summary>
At least one of the following <a href="https://developers.cloudflare.com/fundamentals/api/reference/permissions/">token permissions</a> is required:
- <code>Response Compression Write</code>
- <code>Config Settings Write</code>
- <code>Dynamic URL Redirects Write</code>
- <code>Cache Settings Write</code>
- <code>Custom Errors Write</code>
- <code>Origin Write</code>
- <code>Managed headers Write</code>
- <code>Zone Transform Rules Write</code>
- <code>Mass URL Redirects Write</code>
- <code>Magic Firewall Write</code>
- <code>L4 DDoS Managed Ruleset Write</code>
- <code>HTTP DDoS Managed Ruleset Write</code>
- <code>Sanitize Write</code>
- <code>Transform Rules Write</code>
- <code>Select Configuration Write</code>
- <code>Bot Management Write</code>
- <code>Zone WAF Write</code>
- <code>Account WAF Write</code>
- <code>Account Rulesets Write</code>
- <code>Logs Write</code>
- <code>Logs Write</code>
</details>
Update a zone rulesetbash
curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/rulesets/$RULESET_ID" \
--request PUT \
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
--json '{
"description": "My updated phase entry point ruleset"
}'
{
"result": {
"id": "<RULESET_ID>",
"name": "Zone entry point",
"description": "My updated phase entry point ruleset",
"kind": "zone",
"version": "4",
"rules": [
// (...)
],
"last_updated": "2025-03-30T10:49:11.006109Z",
"phase": "http_request_firewall_managed"
},
"success": true,
"errors": [],
"messages": []
}
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/ruleset-engine/rulesets-api/update/#page","headline":"Update or deploy a ruleset","description":"Update an existing ruleset or deploy it to a phase using the API.","url":"https://developers.cloudflare.com/ruleset-engine/rulesets-api/update/","inLanguage":"en","image":"https://developers.cloudflare.com/ruleset-engine/rulesets-api/update/og.png?v=f1aecfd170d02608","dateModified":"2026-04-16","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Update a specific rule in a ruleset using the API. title: Update a rule in a ruleset image: https://developers.cloudflare.com/ruleset-engine/rulesets-api/update-rule/og.png?v=ea3b4972b97830df
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/ruleset-engine/llms.txt
Use this file to discover all available pages before exploring further.
Docs