Cloudflare Docs
Firewall Rules
Visit Firewall Rules on GitHub
Set theme to dark (⇧+D)

Cloudflare Filters API

Cloudflare Filters is an API-only component of firewall rules for designing complex criteria that rely on boolean operators and other logic to examine incoming HTTP traffic and look for a match.

For example, a filter matching:

  • An HTTP user agent, and
  • The HTTP path, and
  • The source IP address

Associate a filter with a firewall rule to define the scope of that rule.

Use IP Lists within a filter to refer collectively to a group of IP addresses. Refer to the Rules List API for more information.

Before getting started with the Cloudflare Filters API, familiarize yourself with rule expressions. For a complete reference, refer to Rules language.

​​ Differences from other Cloudflare APIs

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

To get started, review What is a filter?, followed by the Cloudflare Filters JSON object and Endpoints.