Endpoints
To invoke a Cloudflare Firewall Rules API operation, append the endpoint to the Cloudflare API base URL:
https://api.cloudflare.com/client/v4/
For authentication instructions, see Getting Started: Requests in the Cloudflare API documentation.
For help with endpoints and pagination, see Getting Started: Endpoints.
The Cloudflare Firewall Rules API supports the operations outlined below. Visit the associated links for examples.
Operation | Method & Endpoint | Notes |
---|---|---|
Create firewall rules | POST zones/{zone_id}/firewall/rules | Handled as a single transaction. If there is an error, the entire operation fails. |
List firewall rules | GET zones/{zone_id}/firewall/rules | Lists all current firewall rules. Results return paginated with 25 items per page by default. Use optional parameters to narrow results. |
Get firewall rule by ID | GET zones/{zone_id}/firewall/rules/{id} | Retrieve a single firewall rule by ID. |
Update firewall rules | PUT zones/{zone_id}/firewall/rules | Handled as a single transaction. All rules must exist for operation to succeed. If there is an error, the entire operation fails. |
Update a firewall rule by ID | PUT zones/{zone_id}/firewall/rules/{id} | Update a single firewall rule by ID. |
Delete firewall rules | DELETE zones/{zone_id}/firewall/rules | Delete existing firewall rules. Must specify list of firewall rule IDs. Empty requests result in no deletion. Returns HTTP status code 200 if a specified rule does not exist. |
Delete firewall rule by ID | DELETE zones/{zone_id}/firewall/rules/{id} | Delete a firewall rule by ID. |