## List firewall rules `firewall.rules.list(RuleListParams**kwargs) -> SyncV4PagePaginationArray[FirewallRule]` **get** `/zones/{zone_id}/firewall/rules` Fetches firewall rules in a zone. You can filter the results using several optional parameters. ### Parameters - `zone_id: str` Defines an identifier. - `id: Optional[str]` The unique identifier of the firewall rule. - `action: Optional[str]` The action to search for. Must be an exact match. - `description: Optional[str]` A case-insensitive string to find in the description. - `page: Optional[float]` Page number of paginated results. - `paused: Optional[bool]` When true, indicates that the firewall rule is currently paused. - `per_page: Optional[float]` Number of firewall rules per page. ### Returns - `class FirewallRule: …` - `id: Optional[str]` The unique identifier of the firewall rule. - `action: Optional[Action]` The action to apply to a matched request. The `log` action is only available on an Enterprise plan. - `"block"` - `"challenge"` - `"js_challenge"` - `"managed_challenge"` - `"allow"` - `"log"` - `"bypass"` - `description: Optional[str]` An informative summary of the firewall rule. - `filter: Optional[Filter]` - `class FirewallFilter: …` - `id: Optional[str]` The unique identifier of the filter. - `description: Optional[str]` An informative summary of the filter. - `expression: Optional[str]` The filter expression. For more information, refer to [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). - `paused: Optional[bool]` When true, indicates that the filter is currently paused. - `ref: Optional[str]` A short reference tag. Allows you to select related filters. - `class DeletedFilter: …` - `id: str` The unique identifier of the filter. - `deleted: bool` When true, indicates that the firewall rule was deleted. - `paused: Optional[bool]` When true, indicates that the firewall rule is currently paused. - `priority: Optional[float]` The priority of the rule. Optional value used to define the processing order. A lower number indicates a higher priority. If not provided, rules with a defined priority will be processed before rules without a priority. - `products: Optional[List[Product]]` - `"zoneLockdown"` - `"uaBlock"` - `"bic"` - `"hot"` - `"securityLevel"` - `"rateLimit"` - `"waf"` - `ref: Optional[str]` A short reference tag. Allows you to select related firewall rules. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.firewall.rules.list( zone_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "372e67954025e0ba6aaa6d586b9e0b60", "action": "block", "description": "Blocks traffic identified during investigation for MIR-31", "filter": { "id": "372e67954025e0ba6aaa6d586b9e0b61", "description": "Restrict access from these browsers on this address range.", "expression": "(http.request.uri.path ~ \".*wp-login.php\" or http.request.uri.path ~ \".*xmlrpc.php\") and ip.addr ne 172.16.22.155", "paused": false, "ref": "FIL-100" }, "paused": false, "priority": 50, "products": [ "waf" ], "ref": "MIR-31" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ```