How to bulk delete IP Access Rules programmatically?

I have over 1K blocked IPs in IP access rules of the firewall which I want to delete them altogether.
Obviously it is too cumbersome to delete them on the browser. So I’m wondering if there is some API method to delete them im bulk using curl?

I see in the API guide that one can do

curl -X DELETE
-H “X-Auth-Email: [email protected]
-H “X-Auth-Key: REDACTED”
https://api.cloudflare.com/client/v4/zones/d56084adb405e0b7e32c52321bf07be6/firewall/rules?id=cbf4b7a5a2a24e59a03044d6d44ceb09

But I’m not sure how can I delete ALL of the rules.
Appreciate your help about this.

You’d have to write a script to list all of them, then loop through that list and delete each one.

https://api.cloudflare.com/#user-level-firewall-access-rule-list-access-rules

https://api.cloudflare.com/#user-level-firewall-access-rule-delete-access-rule

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.