Add IPs to all sites


Hoping that you are well, I would like if you can instruct me on how to go adding by API, IPs in the IP Access Rules module but for all sites as in the documentation only indicates that you must enter zone id of each site but is there any API parameter or script example that does it for all sites, this is more than anything to globalize a blocklist of malicious IP addresses and not be adding one by one on each site.

Currently I only see this API “{zone_id}/firewall/access_rules/rules”.


You have to first call the zones endpoint to get a list of the zone IDs…
…then loop round each in turn calling the IP Access Rules endpoint for each zone.

Not needed, Cloudflare has a native function to apply an IP access rule to all sites:


This uses the account-level IP Access Rule endpoint, rather than the zone one:

So @telecommillenium810 you just need to use the account-level endpoint:{account_identifier}/firewall/access_rules/rules

1 Like

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