Firewall Rules API

You can fully manage your rules programmatically with the Firewall Rules API.

Before getting started with the Firewall Rules API, make sure you’re familiar with:

Request URL format

The base URL that must precede all calls to the Cloudflare Firewall Rules API is:

https://api.cloudflare.com/client/v4/zones/{zone_id}

where {zone_id} is the value of the Zone ID that appears in your Domain Summary in the Cloudflare dashboard Overview page. This is the domain for which you want to manage firewall rules via the API.

Differences from other Cloudflare APIs

The Firewall Rules API behaves differently from most Cloudflare APIs in two ways:

  • API calls accept and return multiple items, and allow applying data changes to multiple items.
  • Although API calls return the standard response, the error object follows the JSON API standard, such that in an error condition, it is clear which item produced the error and why.

Get started!

To get started, review the Firewall Rules JSON object and Endpoints.