---
title: Access Rules
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/go)

[Firewall](https://developers.cloudflare.com/api/go/resources/firewall)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Access Rules

##### [List IP Access rules](https://developers.cloudflare.com/api/go/resources/firewall/subresources/access_rules/methods/list)

client.Firewall.AccessRules.List(ctx, params) (\*V4PagePaginationArray\[[AccessRuleListResponse](<https://developers.cloudflare.com/api/go/resources/firewall#(resource)%20firewall.access_rules%20%3E%20(model)%20AccessRuleListResponse%20%3E%20(schema)>)], error)

GET/{accounts\_or\_zones}/{account\_or\_zone\_id}/firewall/access\_rules/rules

##### [Get an IP Access rule](https://developers.cloudflare.com/api/go/resources/firewall/subresources/access_rules/methods/get)

client.Firewall.AccessRules.Get(ctx, ruleID, query) (\*[AccessRuleGetResponse](<https://developers.cloudflare.com/api/go/resources/firewall#(resource)%20firewall.access_rules%20%3E%20(model)%20AccessRuleGetResponse%20%3E%20(schema)>), error)

GET/{accounts\_or\_zones}/{account\_or\_zone\_id}/firewall/access\_rules/rules/{rule\_id}

##### [Create an IP Access rule](https://developers.cloudflare.com/api/go/resources/firewall/subresources/access_rules/methods/create)

client.Firewall.AccessRules.New(ctx, params) (\*[AccessRuleNewResponse](<https://developers.cloudflare.com/api/go/resources/firewall#(resource)%20firewall.access_rules%20%3E%20(model)%20AccessRuleNewResponse%20%3E%20(schema)>), error)

POST/{accounts\_or\_zones}/{account\_or\_zone\_id}/firewall/access\_rules/rules

##### [Update an IP Access rule](https://developers.cloudflare.com/api/go/resources/firewall/subresources/access_rules/methods/edit)

client.Firewall.AccessRules.Edit(ctx, ruleID, params) (\*[AccessRuleEditResponse](<https://developers.cloudflare.com/api/go/resources/firewall#(resource)%20firewall.access_rules%20%3E%20(model)%20AccessRuleEditResponse%20%3E%20(schema)>), error)

PATCH/{accounts\_or\_zones}/{account\_or\_zone\_id}/firewall/access\_rules/rules/{rule\_id}

##### [Delete an IP Access rule](https://developers.cloudflare.com/api/go/resources/firewall/subresources/access_rules/methods/delete)

client.Firewall.AccessRules.Delete(ctx, ruleID, body) (\*[AccessRuleDeleteResponse](<https://developers.cloudflare.com/api/go/resources/firewall#(resource)%20firewall.access_rules%20%3E%20(model)%20AccessRuleDeleteResponse%20%3E%20(schema)>), error)

DELETE/{accounts\_or\_zones}/{account\_or\_zone\_id}/firewall/access\_rules/rules/{rule\_id}

##### ModelsExpand Collapse

<details>

<summary>

type AccessRuleCIDRConfiguration struct{…}

</summary>

Target AccessRuleCIDRConfigurationTargetOptional

The configuration target. You must set the target to <code>ip_range</code> when specifying an IP address range in the rule.

<a href="#(resource)%20firewall.access_rules%20%3E%20(model)%20access_rule_cidr_configuration%20%3E%20(schema)%20%3E%20(property)%20target">Link to this property</a>

Value stringOptional

The IP address range to match. You can only use prefix lengths <code>/16</code> and <code>/24</code> for IPv4 ranges, and prefix lengths <code>/32</code>, <code>/48</code>, and <code>/64</code> for IPv6 ranges.

<a href="#(resource)%20firewall.access_rules%20%3E%20(model)%20access_rule_cidr_configuration%20%3E%20(schema)%20%3E%20(property)%20value">Link to this property</a>

</details>

[Link to this property](<#(resource)%20firewall.access_rules%20%3E%20(model)%20access_rule_cidr_configuration%20%3E%20(schema)>)

<details>

<summary>

type AccessRuleIPConfiguration struct{…}

</summary>

Target AccessRuleIPConfigurationTargetOptional

The configuration target. You must set the target to <code>ip</code> when specifying an IP address in the rule.

<a href="#(resource)%20firewall.access_rules%20%3E%20(model)%20access_rule_ip_configuration%20%3E%20(schema)%20%3E%20(property)%20target">Link to this property</a>

Value stringOptional

The IP address to match. This address will be compared to the IP address of incoming requests.

<a href="#(resource)%20firewall.access_rules%20%3E%20(model)%20access_rule_ip_configuration%20%3E%20(schema)%20%3E%20(property)%20value">Link to this property</a>

</details>

[Link to this property](<#(resource)%20firewall.access_rules%20%3E%20(model)%20access_rule_ip_configuration%20%3E%20(schema)>)

<details>

<summary>

type ASNConfiguration struct{…}

</summary>

Target ASNConfigurationTargetOptional

The configuration target. You must set the target to <code>asn</code> when specifying an Autonomous System Number (ASN) in the rule.

<a href="#(resource)%20firewall.access_rules%20%3E%20(model)%20asn_configuration%20%3E%20(schema)%20%3E%20(property)%20target">Link to this property</a>

Value stringOptional

The AS number to match.

<a href="#(resource)%20firewall.access_rules%20%3E%20(model)%20asn_configuration%20%3E%20(schema)%20%3E%20(property)%20value">Link to this property</a>

</details>

[Link to this property](<#(resource)%20firewall.access_rules%20%3E%20(model)%20asn_configuration%20%3E%20(schema)>)

<details>

<summary>

type CountryConfiguration struct{…}

</summary>

Target CountryConfigurationTargetOptional

The configuration target. You must set the target to <code>country</code> when specifying a country code in the rule.

<a href="#(resource)%20firewall.access_rules%20%3E%20(model)%20country_configuration%20%3E%20(schema)%20%3E%20(property)%20target">Link to this property</a>

Value stringOptional

The two-letter ISO-3166-1 alpha-2 code to match. For more information, refer to <a href="https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/#country">IP Access rules: Parameters</a>.

<a href="#(resource)%20firewall.access_rules%20%3E%20(model)%20country_configuration%20%3E%20(schema)%20%3E%20(property)%20value">Link to this property</a>

</details>

[Link to this property](<#(resource)%20firewall.access_rules%20%3E%20(model)%20country_configuration%20%3E%20(schema)>)

<details>

<summary>

type IPV6Configuration struct{…}

</summary>

Target IPV6ConfigurationTargetOptional

The configuration target. You must set the target to <code>ip6</code> when specifying an IPv6 address in the rule.

<a href="#(resource)%20firewall.access_rules%20%3E%20(model)%20ipv6_configuration%20%3E%20(schema)%20%3E%20(property)%20target">Link to this property</a>

Value stringOptional

The IPv6 address to match.

<a href="#(resource)%20firewall.access_rules%20%3E%20(model)%20ipv6_configuration%20%3E%20(schema)%20%3E%20(property)%20value">Link to this property</a>

</details>

[Link to this property](<#(resource)%20firewall.access_rules%20%3E%20(model)%20ipv6_configuration%20%3E%20(schema)>)