Cloudflare Docs
Ruleset Engine
Edit this page
Report an issue with this page
Log into the Cloudflare dashboard
Set theme to dark (⇧+D)

Delete a rule in a ruleset

Deletes a single rule in a ruleset at the account or zone level.

Use one of the following API endpoints:

OperationMethod + Endpoint
Delete an account ruleset ruleDELETE /accounts/{account_id}/rulesets/{ruleset_id}/rules/{rule_id}
Delete a zone ruleset ruleDELETE /zones/{zone_id}/rulesets/{ruleset_id}/rules/{rule_id}

If the delete operation succeeds, the API method call returns a 200 OK HTTP status code with the complete ruleset in the response body.

​​ Example

The following example deletes rule {rule_id_1} belonging to ruleset {ruleset_id}.

curl --request DELETE \{account_id}/rulesets/{ruleset_id}/rules/{rule_id_1} \
--header "Authorization: Bearer <API_TOKEN>"
"result": {
"id": "<RULESET_ID>",
"name": "Custom Ruleset 1",
"description": "My first custom ruleset",
"kind": "custom",
"version": "12",
"rules": [
"id": "<RULE_ID_2>",
"version": "2",
"action": "js_challenge",
"expression": "( eq \"GB\" or eq \"FR\") or cf.threat_score > 0",
"description": "challenge GB and FR or based on IP Reputation",
"last_updated": "2021-07-22T12:54:58.144683Z",
"ref": "<RULE_REF_2>",
"enabled": true
"last_updated": "2021-07-22T12:54:58.144683Z",
"phase": "http_request_firewall_custom"
"success": true,
"errors": [],
"messages": []

The response includes the complete ruleset after deleting the rule.