How do I bulk add IP addresses to firewall?

I have ~60 IPs to whitelist and would like to paste the entire list into each of the rules but can’t. It seems to only allow single IP entry at a time. is there a way to to add the entire list with a copy and paste?


You get the PERSONAL-TOKEN from here:

And FIREWALL-ID from the link of your rule

In this example, I added a whitelist for port 443 from inbound coming from source IP1 and IP2

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer PERSONAL-TOKEN" -d '{"inbound_rules":[{"protocol":"tcp","ports":"443","sources":{"addresses":["IP1","IP2"]}}]}' ""

Just remember you will not be able to remove this rule from the GUI

For more information visit:

I was having the same issue so I thought why not help others 😊

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

It doesn’t look like the cloud control panel UI allows you to paste in multiple IP Addresses at once. That’s a good idea for a UI improvement.

In the meantime you can definitely do it via the API

Here is a curl command you can run to create a new Firewall with multiple IP addresses allowed on an inbound rule TCP port 22 rule on a specific droplet:

curl -X POST -H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_DIGITALOCEAN_API_TOKEN" \
-d '{"name":"My-Firewall", "inbound_rules":[{"droplet_ids":[DROPLETID], "protocol":"tcp", "ports":22, "sources":{"addresses":["JSON.ARRAY.OF", "ALL.THE.IP.ADDRESSES", "YOU.WANT.TO.ADD"] } } ] }' \