Cloudflare Docs
Ruleset Engine
Visit Ruleset Engine on GitHub
Set theme to dark (⇧+D)

Delete rulesets

You can use the API to delete all the versions of a ruleset or delete a specific version of a ruleset.

​​ Delete ruleset

Deletes all the versions of an existing ruleset at the account or zone level.

Use one of the following API endpoints:

OperationMethod + Endpoint
Delete account rulesetDELETE /accounts/<ACCOUNT_ID>/rulesets/<RULESET_ID>
Delete zone rulesetDELETE /zones/<ZONE_ID>/rulesets/<RULESET_ID>

If the delete operation succeeds, the API method call returns a 204 No Content HTTP status code.

​​ Example

The following example request deletes an existing ruleset.

Request
curl -X DELETE \
"https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/rulesets/<RULESET_ID>" \
-H "Authorization: Bearer <API_TOKEN>"

​​ Delete ruleset version

Deletes a specific version of a ruleset.

Use one of the following API endpoints:

OperationMethod + Endpoint
Delete a version of an account rulesetDELETE /accounts/<ACCOUNT_ID>/rulesets/<RULESET_ID>/versions/<VERSION_NUMBER>
Delete a version of a zone rulesetDELETE /zones/<ZONE_ID>/rulesets/<RULESET_ID>/versions/<VERSION_NUMBER>

If the delete operation succeeds, the method call returns a 204 No Content HTTP status code.

Later updates to the ruleset will not reuse the version number of a deleted ruleset version.

​​ Example

The following example request deletes a version of an existing ruleset.

Request
curl -X DELETE \
"https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/rulesets/<RULESET_ID>/versions/<VERSION_NUMBER>" \
-H "Authorization: Bearer <API_TOKEN>"