Appending to Firewall rules expressions via API

(How) Is it possible to append another condition to an existing firewall rule via the API?

Suppose I have a rule that blocks access based on the expression (ip.src eq 1.1.1.1) or (ip.src eq 2.2.2.2). Now I want to add another condition with an OR condition to this expression, so that it becomes (ip.src eq 1.1.1.1) or (ip.src eq 2.2.2.2) or (ip.src eq 3.3.3.3).

Is it possible to do this via the API?

You cannot append. You can just replace the whole expression by editing the filter.

https://api.cloudflare.com/#filters-update-individual-filter

Also, (ip.src in {1.1.1.1 2.2.2.2 3.3.3.3}) would be the better approach than an OR concatenation

1 Like

Quick followup - is there a limit to the size of that space-separated list (ip.src in {list} )?

The overall expression cannot contain more than about 4000 characters.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.