# DNS Firewall ## List DNS Firewall Clusters `client.dnsFirewall.list(DNSFirewallListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/dns_firewall` List DNS Firewall clusters for an account ### Parameters - `params: DNSFirewallListParams` - `account_id: string` Path param: Identifier. - `page?: number` Query param: Page number of paginated results - `per_page?: number` Query param: Number of clusters per page ### Returns - `DNSFirewallListResponse` - `id: string` Identifier. - `deprecate_any_requests: boolean` Whether to refuse to answer queries for the ANY type - `dns_firewall_ips: Array` - `ecs_fallback: boolean` Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `maximum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `minimum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `modified_on: string` Last modification of DNS Firewall cluster - `name: string` DNS Firewall cluster name - `negative_cache_ttl: number | null` This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `ratelimit: number | null` Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `retries: number` Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) - `upstream_ips: Array` - `attack_mitigation?: AttackMitigation | null` Attack mitigation settings - `enabled?: boolean` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `only_when_upstream_unhealthy?: boolean` Only mitigate attacks when upstream servers seem unhealthy ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const dnsFirewallListResponse of client.dnsFirewall.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(dnsFirewallListResponse.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" } } ], "success": true, "result": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "deprecate_any_requests": true, "dns_firewall_ips": [ "203.0.113.1", "203.0.113.254", "2001:DB8:AB::CF", "2001:DB8:CD::CF" ], "ecs_fallback": false, "maximum_cache_ttl": 900, "minimum_cache_ttl": 60, "modified_on": "2014-01-01T05:20:00.12345Z", "name": "My Awesome DNS Firewall cluster", "negative_cache_ttl": 900, "ratelimit": 600, "retries": 2, "upstream_ips": [ "192.0.2.1", "198.51.100.1", "2001:DB8:100::CF" ], "attack_mitigation": { "enabled": true, "only_when_upstream_unhealthy": false } } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## DNS Firewall Cluster Details `client.dnsFirewall.get(stringdnsFirewallId, DNSFirewallGetParamsparams, RequestOptionsoptions?): DNSFirewallGetResponse` **get** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}` Show a single DNS Firewall cluster for an account ### Parameters - `dnsFirewallId: string` Identifier. - `params: DNSFirewallGetParams` - `account_id: string` Identifier. ### Returns - `DNSFirewallGetResponse` - `id: string` Identifier. - `deprecate_any_requests: boolean` Whether to refuse to answer queries for the ANY type - `dns_firewall_ips: Array` - `ecs_fallback: boolean` Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `maximum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `minimum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `modified_on: string` Last modification of DNS Firewall cluster - `name: string` DNS Firewall cluster name - `negative_cache_ttl: number | null` This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `ratelimit: number | null` Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `retries: number` Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) - `upstream_ips: Array` - `attack_mitigation?: AttackMitigation | null` Attack mitigation settings - `enabled?: boolean` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `only_when_upstream_unhealthy?: boolean` Only mitigate attacks when upstream servers seem unhealthy ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const dnsFirewall = await client.dnsFirewall.get('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(dnsFirewall.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" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "deprecate_any_requests": true, "dns_firewall_ips": [ "203.0.113.1", "203.0.113.254", "2001:DB8:AB::CF", "2001:DB8:CD::CF" ], "ecs_fallback": false, "maximum_cache_ttl": 900, "minimum_cache_ttl": 60, "modified_on": "2014-01-01T05:20:00.12345Z", "name": "My Awesome DNS Firewall cluster", "negative_cache_ttl": 900, "ratelimit": 600, "retries": 2, "upstream_ips": [ "192.0.2.1", "198.51.100.1", "2001:DB8:100::CF" ], "attack_mitigation": { "enabled": true, "only_when_upstream_unhealthy": false } } } ``` ## Create DNS Firewall Cluster `client.dnsFirewall.create(DNSFirewallCreateParamsparams, RequestOptionsoptions?): DNSFirewallCreateResponse` **post** `/accounts/{account_id}/dns_firewall` Create a DNS Firewall cluster ### Parameters - `params: DNSFirewallCreateParams` - `account_id: string` Path param: Identifier. - `name: string` Body param: DNS Firewall cluster name - `upstream_ips: Array` Body param - `attack_mitigation?: AttackMitigation | null` Body param: Attack mitigation settings - `enabled?: boolean` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `only_when_upstream_unhealthy?: boolean` Only mitigate attacks when upstream servers seem unhealthy - `deprecate_any_requests?: boolean` Body param: Whether to refuse to answer queries for the ANY type - `ecs_fallback?: boolean` Body param: Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `maximum_cache_ttl?: number` Body param: By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `minimum_cache_ttl?: number` Body param: By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `negative_cache_ttl?: number | null` Body param: This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `ratelimit?: number | null` Body param: Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `retries?: number` Body param: Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) ### Returns - `DNSFirewallCreateResponse` - `id: string` Identifier. - `deprecate_any_requests: boolean` Whether to refuse to answer queries for the ANY type - `dns_firewall_ips: Array` - `ecs_fallback: boolean` Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `maximum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `minimum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `modified_on: string` Last modification of DNS Firewall cluster - `name: string` DNS Firewall cluster name - `negative_cache_ttl: number | null` This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `ratelimit: number | null` Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `retries: number` Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) - `upstream_ips: Array` - `attack_mitigation?: AttackMitigation | null` Attack mitigation settings - `enabled?: boolean` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `only_when_upstream_unhealthy?: boolean` Only mitigate attacks when upstream servers seem unhealthy ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const dnsFirewall = await client.dnsFirewall.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'My Awesome DNS Firewall cluster', upstream_ips: ['192.0.2.1', '198.51.100.1', '2001:DB8:100::CF'], }); console.log(dnsFirewall.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" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "deprecate_any_requests": true, "dns_firewall_ips": [ "203.0.113.1", "203.0.113.254", "2001:DB8:AB::CF", "2001:DB8:CD::CF" ], "ecs_fallback": false, "maximum_cache_ttl": 900, "minimum_cache_ttl": 60, "modified_on": "2014-01-01T05:20:00.12345Z", "name": "My Awesome DNS Firewall cluster", "negative_cache_ttl": 900, "ratelimit": 600, "retries": 2, "upstream_ips": [ "192.0.2.1", "198.51.100.1", "2001:DB8:100::CF" ], "attack_mitigation": { "enabled": true, "only_when_upstream_unhealthy": false } } } ``` ## Update DNS Firewall Cluster `client.dnsFirewall.edit(stringdnsFirewallId, DNSFirewallEditParamsparams, RequestOptionsoptions?): DNSFirewallEditResponse` **patch** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}` Modify the configuration of a DNS Firewall cluster ### Parameters - `dnsFirewallId: string` Identifier. - `params: DNSFirewallEditParams` - `account_id: string` Path param: Identifier. - `attack_mitigation?: AttackMitigation | null` Body param: Attack mitigation settings - `enabled?: boolean` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `only_when_upstream_unhealthy?: boolean` Only mitigate attacks when upstream servers seem unhealthy - `deprecate_any_requests?: boolean` Body param: Whether to refuse to answer queries for the ANY type - `ecs_fallback?: boolean` Body param: Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `maximum_cache_ttl?: number` Body param: By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `minimum_cache_ttl?: number` Body param: By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `name?: string` Body param: DNS Firewall cluster name - `negative_cache_ttl?: number | null` Body param: This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `ratelimit?: number | null` Body param: Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `retries?: number` Body param: Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) - `upstream_ips?: Array` Body param ### Returns - `DNSFirewallEditResponse` - `id: string` Identifier. - `deprecate_any_requests: boolean` Whether to refuse to answer queries for the ANY type - `dns_firewall_ips: Array` - `ecs_fallback: boolean` Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `maximum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `minimum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `modified_on: string` Last modification of DNS Firewall cluster - `name: string` DNS Firewall cluster name - `negative_cache_ttl: number | null` This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `ratelimit: number | null` Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `retries: number` Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) - `upstream_ips: Array` - `attack_mitigation?: AttackMitigation | null` Attack mitigation settings - `enabled?: boolean` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `only_when_upstream_unhealthy?: boolean` Only mitigate attacks when upstream servers seem unhealthy ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.dnsFirewall.edit('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(response.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" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "deprecate_any_requests": true, "dns_firewall_ips": [ "203.0.113.1", "203.0.113.254", "2001:DB8:AB::CF", "2001:DB8:CD::CF" ], "ecs_fallback": false, "maximum_cache_ttl": 900, "minimum_cache_ttl": 60, "modified_on": "2014-01-01T05:20:00.12345Z", "name": "My Awesome DNS Firewall cluster", "negative_cache_ttl": 900, "ratelimit": 600, "retries": 2, "upstream_ips": [ "192.0.2.1", "198.51.100.1", "2001:DB8:100::CF" ], "attack_mitigation": { "enabled": true, "only_when_upstream_unhealthy": false } } } ``` ## Delete DNS Firewall Cluster `client.dnsFirewall.delete(stringdnsFirewallId, DNSFirewallDeleteParamsparams, RequestOptionsoptions?): DNSFirewallDeleteResponse` **delete** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}` Delete a DNS Firewall cluster ### Parameters - `dnsFirewallId: string` Identifier. - `params: DNSFirewallDeleteParams` - `account_id: string` Identifier. ### Returns - `DNSFirewallDeleteResponse` - `id?: string` Identifier. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const dnsFirewall = await client.dnsFirewall.delete('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(dnsFirewall.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" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353" } } ``` ## Domain Types ### Attack Mitigation - `AttackMitigation` Attack mitigation settings - `enabled?: boolean` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `only_when_upstream_unhealthy?: boolean` Only mitigate attacks when upstream servers seem unhealthy ### Firewall IPs - `FirewallIPs = string` Cloudflare-assigned DNS IPv4 address ### Upstream IPs - `UpstreamIPs = string` Upstream DNS Server IPv4 address ### DNS Firewall List Response - `DNSFirewallListResponse` - `id: string` Identifier. - `deprecate_any_requests: boolean` Whether to refuse to answer queries for the ANY type - `dns_firewall_ips: Array` - `ecs_fallback: boolean` Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `maximum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `minimum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `modified_on: string` Last modification of DNS Firewall cluster - `name: string` DNS Firewall cluster name - `negative_cache_ttl: number | null` This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `ratelimit: number | null` Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `retries: number` Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) - `upstream_ips: Array` - `attack_mitigation?: AttackMitigation | null` Attack mitigation settings - `enabled?: boolean` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `only_when_upstream_unhealthy?: boolean` Only mitigate attacks when upstream servers seem unhealthy ### DNS Firewall Get Response - `DNSFirewallGetResponse` - `id: string` Identifier. - `deprecate_any_requests: boolean` Whether to refuse to answer queries for the ANY type - `dns_firewall_ips: Array` - `ecs_fallback: boolean` Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `maximum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `minimum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `modified_on: string` Last modification of DNS Firewall cluster - `name: string` DNS Firewall cluster name - `negative_cache_ttl: number | null` This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `ratelimit: number | null` Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `retries: number` Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) - `upstream_ips: Array` - `attack_mitigation?: AttackMitigation | null` Attack mitigation settings - `enabled?: boolean` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `only_when_upstream_unhealthy?: boolean` Only mitigate attacks when upstream servers seem unhealthy ### DNS Firewall Create Response - `DNSFirewallCreateResponse` - `id: string` Identifier. - `deprecate_any_requests: boolean` Whether to refuse to answer queries for the ANY type - `dns_firewall_ips: Array` - `ecs_fallback: boolean` Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `maximum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `minimum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `modified_on: string` Last modification of DNS Firewall cluster - `name: string` DNS Firewall cluster name - `negative_cache_ttl: number | null` This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `ratelimit: number | null` Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `retries: number` Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) - `upstream_ips: Array` - `attack_mitigation?: AttackMitigation | null` Attack mitigation settings - `enabled?: boolean` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `only_when_upstream_unhealthy?: boolean` Only mitigate attacks when upstream servers seem unhealthy ### DNS Firewall Edit Response - `DNSFirewallEditResponse` - `id: string` Identifier. - `deprecate_any_requests: boolean` Whether to refuse to answer queries for the ANY type - `dns_firewall_ips: Array` - `ecs_fallback: boolean` Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent - `maximum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets an upper bound on this duration. For caching purposes, higher TTLs will be decreased to the maximum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `minimum_cache_ttl: number` By default, Cloudflare attempts to cache responses for as long as indicated by the TTL received from upstream nameservers. This setting sets a lower bound on this duration. For caching purposes, lower TTLs will be increased to the minimum value defined by this setting. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. Note that, even with this setting, there is no guarantee that a response will be cached for at least the specified duration. Cached responses may be removed earlier for capacity or other operational reasons. - `modified_on: string` Last modification of DNS Firewall cluster - `name: string` DNS Firewall cluster name - `negative_cache_ttl: number | null` This setting controls how long DNS Firewall should cache negative responses (e.g., NXDOMAIN) from the upstream servers. This setting does not affect the TTL value in the DNS response Cloudflare returns to clients. Cloudflare will always forward the TTL value received from upstream nameservers. - `ratelimit: number | null` Ratelimit in queries per second per datacenter (applies to DNS queries sent to the upstream nameservers configured on the cluster) - `retries: number` Number of retries for fetching DNS responses from upstream nameservers (not counting the initial attempt) - `upstream_ips: Array` - `attack_mitigation?: AttackMitigation | null` Attack mitigation settings - `enabled?: boolean` When enabled, automatically mitigate random-prefix attacks to protect upstream DNS servers - `only_when_upstream_unhealthy?: boolean` Only mitigate attacks when upstream servers seem unhealthy ### DNS Firewall Delete Response - `DNSFirewallDeleteResponse` - `id?: string` Identifier. # Analytics # Reports ## Table `client.dnsFirewall.analytics.reports.get(stringdnsFirewallId, ReportGetParamsparams, RequestOptionsoptions?): Report` **get** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}/dns_analytics/report` Retrieves a list of summarised aggregate metrics over a given time period. See [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) for detailed information about the available query parameters. ### Parameters - `dnsFirewallId: string` Identifier. - `params: ReportGetParams` - `account_id: string` Path param: Identifier. - `dimensions?: string` Query param: A comma-separated list of dimensions to group results by. - `filters?: string` Query param: Segmentation filter in 'attribute operator value' format. - `limit?: number` Query param: Limit number of returned metrics. - `metrics?: string` Query param: A comma-separated list of metrics to query. - `since?: string` Query param: Start date and time of requesting data period in ISO 8601 format. - `sort?: string` Query param: A comma-separated list of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). - `until?: string` Query param: End date and time of requesting data period in ISO 8601 format. ### Returns - `Report` - `data: Array` Array with one row per combination of dimension values. - `dimensions: Array` Array of dimension values, representing the combination of dimension values corresponding to this row. - `metrics: Array` Array with one item per requested metric. Each item is a single value. - `data_lag: number` Number of seconds between current time and last processed event, in another words how many seconds of data could be missing. - `max: unknown` Maximum results for each metric (object mapping metric names to values). Currently always an empty object. - `min: unknown` Minimum results for each metric (object mapping metric names to values). Currently always an empty object. - `query: Query` - `dimensions: Array` Array of dimension names. - `limit: number` Limit number of returned metrics. - `metrics: Array` Array of metric names. - `since: string` Start date and time of requesting data period in ISO 8601 format. - `until: string` End date and time of requesting data period in ISO 8601 format. - `filters?: string` Segmentation filter in 'attribute operator value' format. - `sort?: Array` Array of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). - `rows: number` Total number of rows in the result. - `totals: unknown` Total results for metrics across all data (object mapping metric names to values). ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const report = await client.dnsFirewall.analytics.reports.get('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(report.data); ``` #### 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" } } ], "success": true, "result": { "data": [ { "dimensions": [ "NODATA" ], "metrics": [ 0 ] } ], "data_lag": 60, "max": {}, "min": {}, "query": { "dimensions": [ "responseCode", "queryName" ], "limit": 100, "metrics": [ "queryCount", "responseTimeAvg" ], "since": "2023-11-11T12:00:00Z", "until": "2023-11-11T13:00:00Z", "filters": "responseCode==NOERROR,queryType==A", "sort": [ "+responseCode", "-queryName" ] }, "rows": 100, "totals": {} } } ``` # Bytimes ## By Time `client.dnsFirewall.analytics.reports.bytimes.get(stringdnsFirewallId, BytimeGetParamsparams, RequestOptionsoptions?): ByTime` **get** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}/dns_analytics/report/bytime` Retrieves a list of aggregate metrics grouped by time interval. See [Analytics API properties](https://developers.cloudflare.com/dns/reference/analytics-api-properties/) for detailed information about the available query parameters. ### Parameters - `dnsFirewallId: string` Identifier. - `params: BytimeGetParams` - `account_id: string` Path param: Identifier. - `dimensions?: string` Query param: A comma-separated list of dimensions to group results by. - `filters?: string` Query param: Segmentation filter in 'attribute operator value' format. - `limit?: number` Query param: Limit number of returned metrics. - `metrics?: string` Query param: A comma-separated list of metrics to query. - `since?: string` Query param: Start date and time of requesting data period in ISO 8601 format. - `sort?: string` Query param: A comma-separated list of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). - `time_delta?: "all" | "auto" | "year" | 7 more` Query param: Unit of time to group data by. - `"all"` - `"auto"` - `"year"` - `"quarter"` - `"month"` - `"week"` - `"day"` - `"hour"` - `"dekaminute"` - `"minute"` - `until?: string` Query param: End date and time of requesting data period in ISO 8601 format. ### Returns - `ByTime` - `data: Array` Array with one row per combination of dimension values. - `dimensions: Array` Array of dimension values, representing the combination of dimension values corresponding to this row. - `metrics: Array>` Array with one item per requested metric. Each item is an array of values, broken down by time interval. - `data_lag: number` Number of seconds between current time and last processed event, in another words how many seconds of data could be missing. - `max: unknown` Maximum results for each metric (object mapping metric names to values). Currently always an empty object. - `min: unknown` Minimum results for each metric (object mapping metric names to values). Currently always an empty object. - `query: Query` - `dimensions: Array` Array of dimension names. - `limit: number` Limit number of returned metrics. - `metrics: Array` Array of metric names. - `since: string` Start date and time of requesting data period in ISO 8601 format. - `time_delta: "all" | "auto" | "year" | 7 more` Unit of time to group data by. - `"all"` - `"auto"` - `"year"` - `"quarter"` - `"month"` - `"week"` - `"day"` - `"hour"` - `"dekaminute"` - `"minute"` - `until: string` End date and time of requesting data period in ISO 8601 format. - `filters?: string` Segmentation filter in 'attribute operator value' format. - `sort?: Array` Array of dimensions to sort by, where each dimension may be prefixed by - (descending) or + (ascending). - `rows: number` Total number of rows in the result. - `time_intervals: Array>` Array of time intervals in the response data. Each interval is represented as an array containing two values: the start time, and the end time. - `totals: unknown` Total results for metrics across all data (object mapping metric names to values). ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const byTime = await client.dnsFirewall.analytics.reports.bytimes.get( '023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(byTime.data); ``` #### 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" } } ], "success": true, "result": { "data": [ { "dimensions": [ "NODATA" ], "metrics": [ [ 0 ] ] } ], "data_lag": 60, "max": {}, "min": {}, "query": { "dimensions": [ "responseCode", "queryName" ], "limit": 100, "metrics": [ "queryCount", "responseTimeAvg" ], "since": "2023-11-11T12:00:00Z", "time_delta": "hour", "until": "2023-11-11T13:00:00Z", "filters": "responseCode==NOERROR,queryType==A", "sort": [ "+responseCode", "-queryName" ] }, "rows": 100, "time_intervals": [ [ "2023-11-11T12:00:00Z" ] ], "totals": {} } } ``` # Reverse DNS ## Show DNS Firewall Cluster Reverse DNS `client.dnsFirewall.reverseDNS.get(stringdnsFirewallId, ReverseDNSGetParamsparams, RequestOptionsoptions?): ReverseDNSGetResponse` **get** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}/reverse_dns` Show reverse DNS configuration (PTR records) for a DNS Firewall cluster ### Parameters - `dnsFirewallId: string` Identifier. - `params: ReverseDNSGetParams` - `account_id: string` Identifier. ### Returns - `ReverseDNSGetResponse` - `ptr: Record` Map of cluster IP addresses to PTR record contents ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const reverseDNS = await client.dnsFirewall.reverseDNS.get('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(reverseDNS.ptr); ``` #### 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" } } ], "success": true, "result": { "ptr": { "foo": "string" } } } ``` ## Update DNS Firewall Cluster Reverse DNS `client.dnsFirewall.reverseDNS.edit(stringdnsFirewallId, ReverseDNSEditParamsparams, RequestOptionsoptions?): ReverseDNSEditResponse` **patch** `/accounts/{account_id}/dns_firewall/{dns_firewall_id}/reverse_dns` Update reverse DNS configuration (PTR records) for a DNS Firewall cluster ### Parameters - `dnsFirewallId: string` Identifier. - `params: ReverseDNSEditParams` - `account_id: string` Path param: Identifier. - `ptr?: Record` Body param: Map of cluster IP addresses to PTR record contents ### Returns - `ReverseDNSEditResponse` - `ptr: Record` Map of cluster IP addresses to PTR record contents ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.dnsFirewall.reverseDNS.edit('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(response.ptr); ``` #### 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" } } ], "success": true, "result": { "ptr": { "foo": "string" } } } ``` ## Domain Types ### Reverse DNS Get Response - `ReverseDNSGetResponse` - `ptr: Record` Map of cluster IP addresses to PTR record contents ### Reverse DNS Edit Response - `ReverseDNSEditResponse` - `ptr: Record` Map of cluster IP addresses to PTR record contents