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:
| Operation | Method + Endpoint | 
|---|---|
| Delete an account ruleset rule | DELETE /accounts/{account_id}/rulesets/{ruleset_id}/rules/{rule_id} | 
| Delete a zone ruleset rule | DELETE /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.
The following example deletes rule $RULE_ID_1 belonging to ruleset $RULESET_ID.
The response will include the complete ruleset after deleting the rule.
Required API token permissions
 
At least one of the following token permissions 
is required:
Mass URL Redirects WriteMagic Firewall WriteL4 DDoS Managed Ruleset WriteTransform Rules WriteSelect Configuration WriteAccount WAF WriteAccount Rulesets WriteLogs Write
curl "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/rulesets/$RULESET_ID/rules/$RULE_ID_1" \  --request DELETE \  --header "Authorization: Bearer $CLOUDFLARE_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": "(ip.src.country eq \"GB\" or ip.src.country 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": []}Was this helpful?
- Resources
 - API
 - New to Cloudflare?
 - Products
 - Sponsorships
 - Open Source
 
- Support
 - Help Center
 - System Status
 - Compliance
 - GDPR
 
- Company
 - cloudflare.com
 - Our team
 - Careers
 
- 2025 Cloudflare, Inc.
 - Privacy Policy
 - Terms of Use
 - Report Security Issues
 - Trademark