| Title: | Interface to the 'Cloudflare' API |
|---|---|
| Description: | An 'R' interface to the 'Cloudflare' REST API (<https://developers.cloudflare.com/api/>). Wraps the v4 API with authenticated requests, response unwrapping, paginated list helpers, and a generic request function so users can call any endpoint that is not yet covered by a dedicated wrapper. |
| Authors: | Athanasia Mo Mowinckel [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-5756-0223>, GitHub: drmowinckels) |
| Maintainer: | Athanasia Mo Mowinckel <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.0.9000 |
| Built: | 2026-07-09 14:31:44 UTC |
| Source: | https://github.com/drmowinckels/cloudflarer |
Reads the Global API Key used together with cf_email() for
Cloudflare's legacy authentication scheme. Prefer creating a
scoped API token instead; see cf_token().
cf_api_key(api_key = NULL)cf_api_key(api_key = NULL)
api_key |
Character. The Global API Key. If |
A character scalar with the API key.
Other authentication:
cf_auth_mode(),
cf_email(),
cf_has_auth(),
cf_sitrep(),
cf_token(),
cf_verify()
withr::with_envvar( c(CLOUDFLARE_API_KEY = "cloudflarer-example-key"), cf_api_key() )withr::with_envvar( c(CLOUDFLARE_API_KEY = "cloudflarer-example-key"), cf_api_key() )
Returns the credential type that the next request would use, based on the current environment:
cf_auth_mode()cf_auth_mode()
"token" – CLOUDFLARE_API_TOKEN is set.
"key" – both CLOUDFLARE_EMAIL and CLOUDFLARE_API_KEY are set.
NA_character_ – no usable credentials are available.
When both are configured, the API token wins because it is the modern, scoped credential type.
A character scalar ("token", "key", or NA_character_).
Other authentication:
cf_api_key(),
cf_email(),
cf_has_auth(),
cf_sitrep(),
cf_token(),
cf_verify()
cf_auth_mode()cf_auth_mode()
Wraps the same GraphQL httpRequests1dGroups node as
cf_zone_requests() but exposes the cache-specific fields:
total requests/bytes, cached requests/bytes, and the derived
cache hit ratios.
cf_cache_ratio( zone_id, since, until, limit = 100L, token = NULL, email = NULL, api_key = NULL )cf_cache_ratio( zone_id, since, until, limit = 100L, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier
( |
since, until
|
Date or |
limit |
Maximum number of rows. Cloudflare caps the underlying query at 10000. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame with columns date (chr), requests,
cached_requests, bytes, cached_bytes,
request_hit_ratio, bandwidth_hit_ratio.
Other analytics:
cf_dns_queries(),
cf_firewall_events_by_day(),
cf_firewall_events_top(),
cf_get_rum_site(),
cf_graphql(),
cf_list_rum_sites(),
cf_rum_page_views(),
cf_rum_top(),
cf_workers_invocations(),
cf_zone_overview(),
cf_zone_requests()
cf_cache_ratio( "abc123", since = Sys.Date() - 7, until = Sys.Date() )cf_cache_ratio( "abc123", since = Sys.Date() - 7, until = Sys.Date() )
Given a request built with cf_request() (optionally with query
filters piped on), walks every page of a Cloudflare list endpoint
and concatenates the result arrays into a single list. Page
size and paging cursor are added as query parameters on each
request.
cf_collect(req, per_page = 50, max_pages = Inf, progress = FALSE, ...)cf_collect(req, per_page = 50, max_pages = Inf, progress = FALSE, ...)
req |
An |
per_page |
Integer page size. Cloudflare caps most endpoints at 50; some allow up to 1000. |
max_pages |
Optional integer. Stop after collecting this
many pages. Useful for exploratory calls against large
accounts. |
progress |
Whether to show a progress bar while paging. |
... |
Additional arguments passed to
|
A list of records.
Other requests:
cf_request(),
cf_resp()
cf_request("zones") |> cf_collect(per_page = 50)cf_request("zones") |> cf_collect(per_page = 50)
Registers a customer hostname with SSL-for-SaaS.
cf_create_custom_hostname( zone_id, hostname, ssl_method = "txt", ssl_type = "dv", ssl = NULL, custom_metadata = NULL, custom_origin_server = NULL, ..., token = NULL, email = NULL, api_key = NULL )cf_create_custom_hostname( zone_id, hostname, ssl_method = "txt", ssl_type = "dv", ssl = NULL, custom_metadata = NULL, custom_origin_server = NULL, ..., token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
hostname |
Customer-facing hostname (e.g.
|
ssl_method |
Domain Control Validation method: |
ssl_type |
Certificate type, typically |
ssl |
Optional named list overriding the default SSL config.
When supplied, takes precedence over |
custom_metadata |
Optional named list of metadata stored with the hostname. |
custom_origin_server |
Optional custom origin server (overrides zone fallback). |
... |
Additional fields forwarded to the API. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the created custom hostname.
Other ssl:
cf_delete_custom_hostname(),
cf_get_certificate_pack(),
cf_get_custom_hostname(),
cf_list_certificate_packs(),
cf_list_custom_hostnames()
## Not run: cf_create_custom_hostname( "zone-1", hostname = "shop.customer.com", ssl_method = "txt" ) ## End(Not run)## Not run: cf_create_custom_hostname( "zone-1", hostname = "shop.customer.com", ssl_method = "txt" ) ## End(Not run)
Create a D1 database
cf_create_d1_database( account_id, name, primary_location_hint = NULL, ..., token = NULL, email = NULL, api_key = NULL )cf_create_d1_database( account_id, name, primary_location_hint = NULL, ..., token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
name |
Database name. Must be unique within the account. |
primary_location_hint |
Optional Cloudflare region hint
( |
... |
Additional fields forwarded to the API. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the created database.
Other d1:
cf_d1_query(),
cf_delete_d1_database(),
cf_get_d1_database(),
cf_list_d1_databases()
## Not run: cf_create_d1_database("acc-1", name = "users") ## End(Not run)## Not run: cf_create_d1_database("acc-1", name = "users") ## End(Not run)
Create a DNS record
cf_create_dns_record( zone_id, type, name, content, ttl = 1, proxied = NULL, priority = NULL, comment = NULL, ..., token = NULL, email = NULL, api_key = NULL )cf_create_dns_record( zone_id, type, name, content, ttl = 1, proxied = NULL, priority = NULL, comment = NULL, ..., token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
type |
Record type: |
name |
Record name (host). For the apex, pass |
content |
Record content. For |
ttl |
Time to live in seconds. |
proxied |
Logical. Whether the record is proxied through Cloudflare. Applies to A/AAAA/CNAME. |
priority |
Integer. Required for |
comment |
Optional human-readable comment. |
... |
Additional fields forwarded to the API for record
types with extra requirements ( |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the created record.
Other dns:
cf_delete_dns_record(),
cf_get_dns_record(),
cf_list_dns_records(),
cf_update_dns_record()
cf_create_dns_record( "zone-1", type = "A", name = "www", content = "192.0.2.1", proxied = TRUE )cf_create_dns_record( "zone-1", type = "A", name = "www", content = "192.0.2.1", proxied = TRUE )
Create a healthcheck
cf_create_healthcheck( zone_id, name, address, type = "HTTPS", check_regions = NULL, http_config = NULL, tcp_config = NULL, interval = 60, retries = 2, timeout = 5, description = NULL, suspended = NULL, ..., token = NULL, email = NULL, api_key = NULL )cf_create_healthcheck( zone_id, name, address, type = "HTTPS", check_regions = NULL, http_config = NULL, tcp_config = NULL, interval = 60, retries = 2, timeout = 5, description = NULL, suspended = NULL, ..., token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
name |
Display name for the healthcheck. |
address |
Hostname or IPv4/IPv6 address to monitor. |
type |
One of |
check_regions |
Optional character vector of Cloudflare region
codes ( |
http_config |
Optional named list with HTTP/HTTPS-specific
fields ( |
tcp_config |
Optional named list with TCP-specific fields
( |
interval |
Polling interval in seconds. |
retries |
Number of retries before marking unhealthy. |
timeout |
Timeout per check, in seconds. |
description |
Optional human-readable description. |
suspended |
Logical. When |
... |
Additional fields forwarded to the API. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the created healthcheck.
Other healthchecks:
cf_delete_healthcheck(),
cf_get_healthcheck(),
cf_list_healthchecks(),
cf_update_healthcheck()
## Not run: cf_create_healthcheck( "zone-1", name = "api-prod", address = "api.example.com", type = "HTTPS", http_config = list(path = "/health", expected_codes = "200") ) ## End(Not run)## Not run: cf_create_healthcheck( "zone-1", name = "api-prod", address = "api.example.com", type = "HTTPS", http_config = list(path = "/health", expected_codes = "200") ) ## End(Not run)
Create a Workers KV namespace
cf_create_kv_namespace( account_id, title, token = NULL, email = NULL, api_key = NULL )cf_create_kv_namespace( account_id, title, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
title |
Character. Human-readable namespace name. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the created namespace.
Other workers:
cf_delete_kv_namespace(),
cf_delete_kv_value(),
cf_delete_kv_values(),
cf_get_kv_namespace(),
cf_get_kv_value(),
cf_get_workers_script(),
cf_list_kv_keys(),
cf_list_kv_namespaces(),
cf_list_workers_scripts(),
cf_put_kv_value(),
cf_put_kv_values(),
cf_rename_kv_namespace(),
cf_workers_invocations()
cf_create_kv_namespace("abc123", "sessions")cf_create_kv_namespace("abc123", "sessions")
Each rule applies a list of actions whenever a request matches
one of targets. The most common pattern: a single URL-match
target plus one cache-related action (for example
cache_level = "cache_everything" to bump a static site's hit
ratio).
cf_create_page_rule( zone_id, targets, actions, priority = 1L, status = c("active", "disabled"), token = NULL, email = NULL, api_key = NULL )cf_create_page_rule( zone_id, targets, actions, priority = 1L, status = c("active", "disabled"), token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
targets |
A list of target specifications. The simplest
form is a single URL-match created by |
actions |
A list of action specifications. The simplest
form is a list created by |
priority |
Integer. Higher number = applied first. |
status |
|
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the created rule.
Other zones:
cf_delete_page_rule(),
cf_get_page_rule(),
cf_get_zone(),
cf_get_zone_setting(),
cf_get_zone_settings(),
cf_list_firewall_rules(),
cf_list_page_rules(),
cf_list_zones(),
cf_page_rule_action(),
cf_page_rule_target(),
cf_update_page_rule()
cf_create_page_rule( "abc123", targets = list( cf_page_rule_target("*example.com/blog/*") ), actions = list( cf_page_rule_action("cache_level", "cache_everything"), cf_page_rule_action("edge_cache_ttl", 7200) ) )cf_create_page_rule( "abc123", targets = list( cf_page_rule_target("*example.com/blog/*") ), actions = list( cf_page_rule_action("cache_level", "cache_everything"), cf_page_rule_action("edge_cache_ttl", 7200) ) )
Create a Turnstile widget
cf_create_turnstile_widget( account_id, name, domains, mode = c("managed", "non-interactive", "invisible"), bot_fight_mode = FALSE, region = "world", token = NULL, email = NULL, api_key = NULL )cf_create_turnstile_widget( account_id, name, domains, mode = c("managed", "non-interactive", "invisible"), bot_fight_mode = FALSE, region = "world", token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
name |
Character. Human-readable widget name. |
domains |
Character vector of domains where the widget will be embedded. |
mode |
Character. Visibility mode: |
bot_fight_mode |
Logical. Enable Bot Fight Mode integration. |
region |
Character. Where Turnstile runs from. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list with the created widget, including its
sitekey and secret (only shown once).
Other turnstile:
cf_delete_turnstile_widget(),
cf_get_turnstile_widget(),
cf_list_turnstile_widgets()
cf_create_turnstile_widget( "abc123", name = "comment-form", domains = c("example.com", "www.example.com"), mode = "managed" )cf_create_turnstile_widget( "abc123", name = "comment-form", domains = c("example.com", "www.example.com"), mode = "managed" )
Executes one or more SQL statements against the database. Use
params for parameterised queries to avoid string-interpolation
issues.
cf_d1_query( account_id, database_id, sql, params = NULL, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_d1_query( account_id, database_id, sql, params = NULL, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
database_id |
Character. D1 database |
sql |
Character. SQL statement(s) to execute. |
params |
Optional character vector of positional parameters
bound to the |
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of result rows when as_df = TRUE, otherwise
the raw response (a list of result blocks, each with success,
meta, and results).
Other d1:
cf_create_d1_database(),
cf_delete_d1_database(),
cf_get_d1_database(),
cf_list_d1_databases()
## Not run: cf_d1_query("acc-1", "db-1", "SELECT * FROM users WHERE id = ?", params = "42") ## End(Not run)## Not run: cf_d1_query("acc-1", "db-1", "SELECT * FROM users WHERE id = ?", params = "42") ## End(Not run)
Delete a custom hostname
cf_delete_custom_hostname( zone_id, custom_hostname_id, token = NULL, email = NULL, api_key = NULL )cf_delete_custom_hostname( zone_id, custom_hostname_id, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
custom_hostname_id |
Character. Custom hostname identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list with the deleted hostname's id.
Other ssl:
cf_create_custom_hostname(),
cf_get_certificate_pack(),
cf_get_custom_hostname(),
cf_list_certificate_packs(),
cf_list_custom_hostnames()
## Not run: cf_delete_custom_hostname("zone-1", "ch-1") ## End(Not run)## Not run: cf_delete_custom_hostname("zone-1", "ch-1") ## End(Not run)
Delete a D1 database
cf_delete_d1_database( account_id, database_id, token = NULL, email = NULL, api_key = NULL )cf_delete_d1_database( account_id, database_id, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
database_id |
Character. D1 database |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list with the API response.
Other d1:
cf_create_d1_database(),
cf_d1_query(),
cf_get_d1_database(),
cf_list_d1_databases()
## Not run: cf_delete_d1_database("acc-1", "db-1") ## End(Not run)## Not run: cf_delete_d1_database("acc-1", "db-1") ## End(Not run)
Delete a DNS record
cf_delete_dns_record( zone_id, record_id, token = NULL, email = NULL, api_key = NULL )cf_delete_dns_record( zone_id, record_id, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
record_id |
Character. DNS record identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list with the deleted record's id.
Other dns:
cf_create_dns_record(),
cf_get_dns_record(),
cf_list_dns_records(),
cf_update_dns_record()
cf_delete_dns_record("zone-1", "rec-1")cf_delete_dns_record("zone-1", "rec-1")
Delete a healthcheck
cf_delete_healthcheck( zone_id, healthcheck_id, token = NULL, email = NULL, api_key = NULL )cf_delete_healthcheck( zone_id, healthcheck_id, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
healthcheck_id |
Character. Healthcheck identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list with the deleted healthcheck's id.
Other healthchecks:
cf_create_healthcheck(),
cf_get_healthcheck(),
cf_list_healthchecks(),
cf_update_healthcheck()
## Not run: cf_delete_healthcheck("zone-1", "hc-1") ## End(Not run)## Not run: cf_delete_healthcheck("zone-1", "hc-1") ## End(Not run)
Delete a Workers KV namespace
cf_delete_kv_namespace( account_id, namespace_id, token = NULL, email = NULL, api_key = NULL )cf_delete_kv_namespace( account_id, namespace_id, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
namespace_id |
Character. KV namespace identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
NULL, invisibly. Cloudflare returns an empty result on
success.
Other workers:
cf_create_kv_namespace(),
cf_delete_kv_value(),
cf_delete_kv_values(),
cf_get_kv_namespace(),
cf_get_kv_value(),
cf_get_workers_script(),
cf_list_kv_keys(),
cf_list_kv_namespaces(),
cf_list_workers_scripts(),
cf_put_kv_value(),
cf_put_kv_values(),
cf_rename_kv_namespace(),
cf_workers_invocations()
cf_delete_kv_namespace("abc123", "ns-1")cf_delete_kv_namespace("abc123", "ns-1")
Delete a value from a Workers KV namespace
cf_delete_kv_value( account_id, namespace_id, key_name, token = NULL, email = NULL, api_key = NULL )cf_delete_kv_value( account_id, namespace_id, key_name, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
namespace_id |
Character. KV namespace identifier. |
key_name |
Character. Key to read. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
NULL, invisibly. Cloudflare returns an empty result on
success.
Other workers:
cf_create_kv_namespace(),
cf_delete_kv_namespace(),
cf_delete_kv_values(),
cf_get_kv_namespace(),
cf_get_kv_value(),
cf_get_workers_script(),
cf_list_kv_keys(),
cf_list_kv_namespaces(),
cf_list_workers_scripts(),
cf_put_kv_value(),
cf_put_kv_values(),
cf_rename_kv_namespace(),
cf_workers_invocations()
cf_delete_kv_value("abc123", "ns-1", "greeting")cf_delete_kv_value("abc123", "ns-1", "greeting")
Delete multiple keys from a Workers KV namespace
cf_delete_kv_values( account_id, namespace_id, keys, token = NULL, email = NULL, api_key = NULL )cf_delete_kv_values( account_id, namespace_id, keys, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
namespace_id |
Character. KV namespace identifier. |
keys |
Character vector of key names to delete. Up to 10,000 keys per call. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list with successful_key_count and
unsuccessful_keys.
Other workers:
cf_create_kv_namespace(),
cf_delete_kv_namespace(),
cf_delete_kv_value(),
cf_get_kv_namespace(),
cf_get_kv_value(),
cf_get_workers_script(),
cf_list_kv_keys(),
cf_list_kv_namespaces(),
cf_list_workers_scripts(),
cf_put_kv_value(),
cf_put_kv_values(),
cf_rename_kv_namespace(),
cf_workers_invocations()
cf_delete_kv_values("abc123", "ns-1", c("greeting", "farewell"))cf_delete_kv_values("abc123", "ns-1", c("greeting", "farewell"))
Delete a Page Rule
cf_delete_page_rule( zone_id, rule_id, token = NULL, email = NULL, api_key = NULL )cf_delete_page_rule( zone_id, rule_id, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
rule_id |
Character. Page Rule identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list with the deleted rule's id.
Other zones:
cf_create_page_rule(),
cf_get_page_rule(),
cf_get_zone(),
cf_get_zone_setting(),
cf_get_zone_settings(),
cf_list_firewall_rules(),
cf_list_page_rules(),
cf_list_zones(),
cf_page_rule_action(),
cf_page_rule_target(),
cf_update_page_rule()
cf_delete_page_rule("abc123", "rule-1")cf_delete_page_rule("abc123", "rule-1")
Delete a Turnstile widget
cf_delete_turnstile_widget( account_id, sitekey, token = NULL, email = NULL, api_key = NULL )cf_delete_turnstile_widget( account_id, sitekey, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
sitekey |
Character. Widget sitekey. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list with the deleted widget's sitekey.
Other turnstile:
cf_create_turnstile_widget(),
cf_get_turnstile_widget(),
cf_list_turnstile_widgets()
cf_delete_turnstile_widget("abc123", "0x4AAA...")cf_delete_turnstile_widget("abc123", "0x4AAA...")
Wraps the Cloudflare GraphQL dnsAnalyticsAdaptiveGroups node,
grouped by day. Returns a tidy data.frame.
cf_dns_queries( zone_id, since, until, limit = 100L, token = NULL, email = NULL, api_key = NULL )cf_dns_queries( zone_id, since, until, limit = 100L, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier
( |
since, until
|
Date or |
limit |
Maximum number of rows. Cloudflare caps the underlying query at 10000. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
Requires an API token with the Account Analytics: Read (or
Zone Analytics: Read) permission. The legacy Global API Key
has full access.
A data.frame with columns date (chr) and queries
(int).
Other analytics:
cf_cache_ratio(),
cf_firewall_events_by_day(),
cf_firewall_events_top(),
cf_get_rum_site(),
cf_graphql(),
cf_list_rum_sites(),
cf_rum_page_views(),
cf_rum_top(),
cf_workers_invocations(),
cf_zone_overview(),
cf_zone_requests()
cf_dns_queries( "abc123", since = Sys.Date() - 7, until = Sys.Date() )cf_dns_queries( "abc123", since = Sys.Date() - 7, until = Sys.Date() )
Reads the account email used together with cf_api_key() for
Cloudflare's legacy Global API Key authentication. Defaults to
Sys.getenv("CLOUDFLARE_EMAIL").
cf_email(email = NULL)cf_email(email = NULL)
email |
Character. Account email. If |
A character scalar with the email address.
Other authentication:
cf_api_key(),
cf_auth_mode(),
cf_has_auth(),
cf_sitrep(),
cf_token(),
cf_verify()
withr::with_envvar( c(CLOUDFLARE_EMAIL = "[email protected]"), cf_email() )withr::with_envvar( c(CLOUDFLARE_EMAIL = "[email protected]"), cf_email() )
Wraps the Cloudflare GraphQL firewallEventsAdaptiveGroups
node, grouped by day. Returns a tidy data.frame with one row
per day.
cf_firewall_events_by_day( zone_id, since, until, limit = 100L, token = NULL, email = NULL, api_key = NULL )cf_firewall_events_by_day( zone_id, since, until, limit = 100L, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier
( |
since, until
|
Date or |
limit |
Maximum number of rows. Cloudflare caps the underlying query at 10000. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
Requires:
A Cloudflare Pro, Business, or Enterprise plan – the underlying GraphQL node is not available on the Free plan.
An API token with Account Analytics: Read (or
Zone Analytics: Read) permission, or the legacy Global API
Key.
Either condition unmet produces a zone ... does not have access to the path error.
A data.frame with columns date (chr) and events
(int).
Other analytics:
cf_cache_ratio(),
cf_dns_queries(),
cf_firewall_events_top(),
cf_get_rum_site(),
cf_graphql(),
cf_list_rum_sites(),
cf_rum_page_views(),
cf_rum_top(),
cf_workers_invocations(),
cf_zone_overview(),
cf_zone_requests()
cf_firewall_events_by_day( "abc123", since = Sys.Date() - 30, until = Sys.Date() )cf_firewall_events_by_day( "abc123", since = Sys.Date() - 30, until = Sys.Date() )
Groups firewallEventsAdaptiveGroups by a single dimension
and returns the top entries by count.
cf_firewall_events_top( zone_id, since, until, dimension = "action", limit = 25L, token = NULL, email = NULL, api_key = NULL )cf_firewall_events_top( zone_id, since, until, dimension = "action", limit = 25L, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier
( |
since, until
|
Date or |
dimension |
Character. Dimension name to group by. Common
choices: |
limit |
Number of rows to return. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame with two columns: the requested
dimension and events (the event count).
Other analytics:
cf_cache_ratio(),
cf_dns_queries(),
cf_firewall_events_by_day(),
cf_get_rum_site(),
cf_graphql(),
cf_list_rum_sites(),
cf_rum_page_views(),
cf_rum_top(),
cf_workers_invocations(),
cf_zone_overview(),
cf_zone_requests()
cf_firewall_events_top( "abc123", since = Sys.Date() - 7, until = Sys.Date(), dimension = "action", limit = 10 )cf_firewall_events_top( "abc123", since = Sys.Date() - 7, until = Sys.Date(), dimension = "action", limit = 10 )
Get a single account
cf_get_account(account_id, token = NULL, email = NULL, api_key = NULL)cf_get_account(account_id, token = NULL, email = NULL, api_key = NULL)
account_id |
Character. Cloudflare account identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the account.
Other accounts:
cf_list_accounts()
cf_get_account("abc123")cf_get_account("abc123")
Get a single account Ruleset (with its rules)
cf_get_account_ruleset( account_id, ruleset_id, token = NULL, email = NULL, api_key = NULL )cf_get_account_ruleset( account_id, ruleset_id, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
ruleset_id |
Character. Ruleset identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the ruleset; its rules element
is itself a list of rule objects.
Other rulesets:
cf_get_ruleset(),
cf_list_account_rulesets(),
cf_list_rulesets()
cf_get_account_ruleset("acc-1", "rs-1")cf_get_account_ruleset("acc-1", "rs-1")
Get a single SSL certificate pack
cf_get_certificate_pack( zone_id, pack_id, token = NULL, email = NULL, api_key = NULL )cf_get_certificate_pack( zone_id, pack_id, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
pack_id |
Character. Certificate pack identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the certificate pack.
Other ssl:
cf_create_custom_hostname(),
cf_delete_custom_hostname(),
cf_get_custom_hostname(),
cf_list_certificate_packs(),
cf_list_custom_hostnames()
## Not run: cf_get_certificate_pack("zone-1", "pack-1") ## End(Not run)## Not run: cf_get_certificate_pack("zone-1", "pack-1") ## End(Not run)
Get a single custom hostname
cf_get_custom_hostname( zone_id, custom_hostname_id, token = NULL, email = NULL, api_key = NULL )cf_get_custom_hostname( zone_id, custom_hostname_id, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
custom_hostname_id |
Character. Custom hostname identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the custom hostname.
Other ssl:
cf_create_custom_hostname(),
cf_delete_custom_hostname(),
cf_get_certificate_pack(),
cf_list_certificate_packs(),
cf_list_custom_hostnames()
## Not run: cf_get_custom_hostname("zone-1", "ch-1") ## End(Not run)## Not run: cf_get_custom_hostname("zone-1", "ch-1") ## End(Not run)
Get a single D1 database
cf_get_d1_database( account_id, database_id, token = NULL, email = NULL, api_key = NULL )cf_get_d1_database( account_id, database_id, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
database_id |
Character. D1 database |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the database.
Other d1:
cf_create_d1_database(),
cf_d1_query(),
cf_delete_d1_database(),
cf_list_d1_databases()
## Not run: cf_get_d1_database("acc-1", "db-1") ## End(Not run)## Not run: cf_get_d1_database("acc-1", "db-1") ## End(Not run)
Get a single DNS record
cf_get_dns_record( zone_id, record_id, token = NULL, email = NULL, api_key = NULL )cf_get_dns_record( zone_id, record_id, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
record_id |
Character. DNS record identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the record.
Other dns:
cf_create_dns_record(),
cf_delete_dns_record(),
cf_list_dns_records(),
cf_update_dns_record()
cf_get_dns_record("zone-1", "rec-1")cf_get_dns_record("zone-1", "rec-1")
Returns the current Email Routing configuration for the zone: enabled/disabled, SPF/MX status, last-modified timestamps.
cf_get_email_routing_settings( zone_id, token = NULL, email = NULL, api_key = NULL )cf_get_email_routing_settings( zone_id, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list with the routing settings.
Other email:
cf_list_email_routing_addresses(),
cf_list_email_routing_rules()
cf_get_email_routing_settings("abc123")cf_get_email_routing_settings("abc123")
Get a single healthcheck
cf_get_healthcheck( zone_id, healthcheck_id, token = NULL, email = NULL, api_key = NULL )cf_get_healthcheck( zone_id, healthcheck_id, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
healthcheck_id |
Character. Healthcheck identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the healthcheck.
Other healthchecks:
cf_create_healthcheck(),
cf_delete_healthcheck(),
cf_list_healthchecks(),
cf_update_healthcheck()
## Not run: cf_get_healthcheck("zone-1", "hc-1") ## End(Not run)## Not run: cf_get_healthcheck("zone-1", "hc-1") ## End(Not run)
Get a single Workers KV namespace
cf_get_kv_namespace( account_id, namespace_id, token = NULL, email = NULL, api_key = NULL )cf_get_kv_namespace( account_id, namespace_id, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
namespace_id |
Character. KV namespace identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the namespace.
Other workers:
cf_create_kv_namespace(),
cf_delete_kv_namespace(),
cf_delete_kv_value(),
cf_delete_kv_values(),
cf_get_kv_value(),
cf_get_workers_script(),
cf_list_kv_keys(),
cf_list_kv_namespaces(),
cf_list_workers_scripts(),
cf_put_kv_value(),
cf_put_kv_values(),
cf_rename_kv_namespace(),
cf_workers_invocations()
cf_get_kv_namespace("abc123", "ns-1")cf_get_kv_namespace("abc123", "ns-1")
Unlike most Cloudflare endpoints, this one returns the raw stored
value rather than a JSON envelope, so the result is not passed
through cf_resp().
cf_get_kv_value( account_id, namespace_id, key_name, as = c("text", "raw"), token = NULL, email = NULL, api_key = NULL )cf_get_kv_value( account_id, namespace_id, key_name, as = c("text", "raw"), token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
namespace_id |
Character. KV namespace identifier. |
key_name |
Character. Key to read. |
as |
Character. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A character string, or a raw vector when as = "raw".
Other workers:
cf_create_kv_namespace(),
cf_delete_kv_namespace(),
cf_delete_kv_value(),
cf_delete_kv_values(),
cf_get_kv_namespace(),
cf_get_workers_script(),
cf_list_kv_keys(),
cf_list_kv_namespaces(),
cf_list_workers_scripts(),
cf_put_kv_value(),
cf_put_kv_values(),
cf_rename_kv_namespace(),
cf_workers_invocations()
cf_get_kv_value("abc123", "ns-1", "greeting")cf_get_kv_value("abc123", "ns-1", "greeting")
Get a single Page Rule
cf_get_page_rule(zone_id, rule_id, token = NULL, email = NULL, api_key = NULL)cf_get_page_rule(zone_id, rule_id, token = NULL, email = NULL, api_key = NULL)
zone_id |
Character. Cloudflare zone identifier. |
rule_id |
Character. Page Rule identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the rule, including its
targets and actions.
Other zones:
cf_create_page_rule(),
cf_delete_page_rule(),
cf_get_zone(),
cf_get_zone_setting(),
cf_get_zone_settings(),
cf_list_firewall_rules(),
cf_list_page_rules(),
cf_list_zones(),
cf_page_rule_action(),
cf_page_rule_target(),
cf_update_page_rule()
cf_get_page_rule("abc123", "rule-1")cf_get_page_rule("abc123", "rule-1")
Get a single Cloudflare Pages project
cf_get_pages_project( account_id, project_name, token = NULL, email = NULL, api_key = NULL )cf_get_pages_project( account_id, project_name, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
project_name |
Character. Pages project name. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the project, including build config, domains, and the latest deployment.
Other pages:
cf_list_pages_deployments(),
cf_list_pages_projects()
cf_get_pages_project("abc123", "my-site")cf_get_pages_project("abc123", "my-site")
Get a single R2 bucket
cf_get_r2_bucket( account_id, bucket_name, token = NULL, email = NULL, api_key = NULL )cf_get_r2_bucket( account_id, bucket_name, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
bucket_name |
Character. R2 bucket name. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the bucket.
Other r2:
cf_list_r2_buckets()
cf_get_r2_bucket("abc123", "my-bucket")cf_get_r2_bucket("abc123", "my-bucket")
Get a single zone Ruleset (with its rules)
cf_get_ruleset(zone_id, ruleset_id, token = NULL, email = NULL, api_key = NULL)cf_get_ruleset(zone_id, ruleset_id, token = NULL, email = NULL, api_key = NULL)
zone_id |
Character. Cloudflare zone identifier. |
ruleset_id |
Character. Ruleset identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the ruleset; its rules element
is itself a list of rule objects.
Other rulesets:
cf_get_account_ruleset(),
cf_list_account_rulesets(),
cf_list_rulesets()
cf_get_ruleset("abc123", "rs-1")cf_get_ruleset("abc123", "rs-1")
Get a single Web Analytics (RUM) site
cf_get_rum_site( account_id, site_tag, token = NULL, email = NULL, api_key = NULL )cf_get_rum_site( account_id, site_tag, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
site_tag |
Character. RUM site tag (sometimes called "site identifier"). |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the site.
Other analytics:
cf_cache_ratio(),
cf_dns_queries(),
cf_firewall_events_by_day(),
cf_firewall_events_top(),
cf_graphql(),
cf_list_rum_sites(),
cf_rum_page_views(),
cf_rum_top(),
cf_workers_invocations(),
cf_zone_overview(),
cf_zone_requests()
cf_get_rum_site("acc-1", "abc-tag")cf_get_rum_site("acc-1", "abc-tag")
Get a single Cloudflare Tunnel
cf_get_tunnel( account_id, tunnel_id, token = NULL, email = NULL, api_key = NULL )cf_get_tunnel( account_id, tunnel_id, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
tunnel_id |
Character. Tunnel identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the tunnel.
Other tunnels:
cf_list_tunnel_connections(),
cf_list_tunnels()
cf_get_tunnel("abc123", "tunnel-1")cf_get_tunnel("abc123", "tunnel-1")
Get a single Turnstile widget
cf_get_turnstile_widget( account_id, sitekey, token = NULL, email = NULL, api_key = NULL )cf_get_turnstile_widget( account_id, sitekey, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
sitekey |
Character. Widget sitekey. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the widget.
Other turnstile:
cf_create_turnstile_widget(),
cf_delete_turnstile_widget(),
cf_list_turnstile_widgets()
cf_get_turnstile_widget("abc123", "0x4AAA...")cf_get_turnstile_widget("abc123", "0x4AAA...")
Returns the script's metadata (placement, bindings, etc.). To
fetch the actual source, use the API's
/workers/scripts/{name}/content endpoint via cf_request().
cf_get_workers_script( account_id, script_name, token = NULL, email = NULL, api_key = NULL )cf_get_workers_script( account_id, script_name, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
script_name |
Character. Worker script name. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list with the script metadata.
Other workers:
cf_create_kv_namespace(),
cf_delete_kv_namespace(),
cf_delete_kv_value(),
cf_delete_kv_values(),
cf_get_kv_namespace(),
cf_get_kv_value(),
cf_list_kv_keys(),
cf_list_kv_namespaces(),
cf_list_workers_scripts(),
cf_put_kv_value(),
cf_put_kv_values(),
cf_rename_kv_namespace(),
cf_workers_invocations()
cf_get_workers_script("abc123", "my-worker")cf_get_workers_script("abc123", "my-worker")
Get a single zone
cf_get_zone(zone_id, token = NULL, email = NULL, api_key = NULL)cf_get_zone(zone_id, token = NULL, email = NULL, api_key = NULL)
zone_id |
Character. Cloudflare zone identifier. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the zone.
Other zones:
cf_create_page_rule(),
cf_delete_page_rule(),
cf_get_page_rule(),
cf_get_zone_setting(),
cf_get_zone_settings(),
cf_list_firewall_rules(),
cf_list_page_rules(),
cf_list_zones(),
cf_page_rule_action(),
cf_page_rule_target(),
cf_update_page_rule()
cf_get_zone("abc123")cf_get_zone("abc123")
Get a single zone setting
cf_get_zone_setting( zone_id, setting, token = NULL, email = NULL, api_key = NULL )cf_get_zone_setting( zone_id, setting, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
setting |
Character. Setting name (for example
|
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list with the setting's id, value,
modified_on, and editability flags.
Other zones:
cf_create_page_rule(),
cf_delete_page_rule(),
cf_get_page_rule(),
cf_get_zone(),
cf_get_zone_settings(),
cf_list_firewall_rules(),
cf_list_page_rules(),
cf_list_zones(),
cf_page_rule_action(),
cf_page_rule_target(),
cf_update_page_rule()
cf_get_zone_setting("abc123", "ssl")cf_get_zone_setting("abc123", "ssl")
Returns the full settings catalogue for a zone (cache level, SSL mode, minify, security level, ...). One row per setting.
cf_get_zone_settings( zone_id, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_get_zone_settings( zone_id, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of settings (or list when as_df = FALSE).
Other zones:
cf_create_page_rule(),
cf_delete_page_rule(),
cf_get_page_rule(),
cf_get_zone(),
cf_get_zone_setting(),
cf_list_firewall_rules(),
cf_list_page_rules(),
cf_list_zones(),
cf_page_rule_action(),
cf_page_rule_target(),
cf_update_page_rule()
cf_get_zone_settings("abc123")cf_get_zone_settings("abc123")
Cloudflare's Analytics GraphQL API
exposes most current and historical analytics datasets (HTTP
requests, DNS, firewall, Workers, R2, etc.) behind a single
endpoint: POST /graphql. The response shape is the standard
GraphQL {data, errors} envelope, not Cloudflare's REST
envelope, so this function is a separate path from
cf_request().
cf_graphql( query, ..., .operation_name = NULL, .token = NULL, .email = NULL, .api_key = NULL, .envir = parent.frame() )cf_graphql( query, ..., .operation_name = NULL, .token = NULL, .email = NULL, .api_key = NULL, .envir = parent.frame() )
query |
Character. A GraphQL query string. |
... |
Named GraphQL variables. For example
|
.operation_name |
Optional operation name when the query contains multiple operations. |
.token, .email, .api_key
|
Optional per-call credentials.
Dot-prefixed to avoid clashing with GraphQL variable names.
See |
.envir |
Environment for error reporting. Defaults to the caller, so error messages point at the user's code. |
Variables are passed through ... as named arguments, the same
pattern used by the meetupr package. All values must be named;
an unnamed value raises an error before the request is made.
The parsed response body, including data and
(when present) extensions. Any non-empty errors array
raises a classed cloudflarer_error.
Other analytics:
cf_cache_ratio(),
cf_dns_queries(),
cf_firewall_events_by_day(),
cf_firewall_events_top(),
cf_get_rum_site(),
cf_list_rum_sites(),
cf_rum_page_views(),
cf_rum_top(),
cf_workers_invocations(),
cf_zone_overview(),
cf_zone_requests()
res <- cf_graphql( "query Viewer($accountTag: String!) { viewer { accounts(filter: { accountTag: $accountTag }) { accountTag } } }", accountTag = "abc123" ) res$data$viewer$accounts res <- cf_graphql( " query ZoneRequests($zoneTag: String!, $since: Date!, $until: Date!) { viewer { zones(filter: { zoneTag: $zoneTag }) { httpRequests1dGroups( limit: 100, filter: { date_geq: $since, date_lt: $until } ) { dimensions { date } sum { requests bytes pageViews } uniq { uniques } } } } } ", zoneTag = "abc123", since = "2026-05-01", until = "2026-05-08" )res <- cf_graphql( "query Viewer($accountTag: String!) { viewer { accounts(filter: { accountTag: $accountTag }) { accountTag } } }", accountTag = "abc123" ) res$data$viewer$accounts res <- cf_graphql( " query ZoneRequests($zoneTag: String!, $since: Date!, $until: Date!) { viewer { zones(filter: { zoneTag: $zoneTag }) { httpRequests1dGroups( limit: 100, filter: { date_geq: $since, date_lt: $until } ) { dimensions { date } sum { requests bytes pageViews } uniq { uniques } } } } } ", zoneTag = "abc123", since = "2026-05-01", until = "2026-05-08" )
Returns TRUE when cf_auth_mode() returns a non-NA value.
Useful in examples, vignettes, and conditional test code.
cf_has_auth()cf_has_auth()
Logical scalar.
Other authentication:
cf_api_key(),
cf_auth_mode(),
cf_email(),
cf_sitrep(),
cf_token(),
cf_verify()
cf_has_auth()cf_has_auth()
Returns the rulesets configured at the account level (typically the curated managed rulesets you can deploy with overrides).
cf_list_account_rulesets( account_id, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_account_rulesets( account_id, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of rulesets (or list when
as_df = FALSE).
Other rulesets:
cf_get_account_ruleset(),
cf_get_ruleset(),
cf_list_rulesets()
cf_list_account_rulesets("acc-1")cf_list_account_rulesets("acc-1")
Lists all accounts the authenticated user has access to.
cf_list_accounts( name = NULL, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_accounts( name = NULL, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
name |
Optional name filter passed to the API. |
per_page |
Page size, see |
max_pages |
Maximum number of pages to retrieve, see
|
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of account records (or a list when
as_df = FALSE).
Other accounts:
cf_get_account()
cf_list_accounts()cf_list_accounts()
Returns the SSL certificate packs (universal, advanced, custom) issued for the zone.
cf_list_certificate_packs( zone_id, status = NULL, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_certificate_packs( zone_id, status = NULL, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
status |
Optional status filter, for example |
per_page, max_pages
|
Pagination controls, see
|
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of certificate pack records (or list when
as_df = FALSE).
Other ssl:
cf_create_custom_hostname(),
cf_delete_custom_hostname(),
cf_get_certificate_pack(),
cf_get_custom_hostname(),
cf_list_custom_hostnames()
## Not run: cf_list_certificate_packs("zone-1") cf_list_certificate_packs("zone-1", status = "active") ## End(Not run)## Not run: cf_list_certificate_packs("zone-1") cf_list_certificate_packs("zone-1", status = "active") ## End(Not run)
Returns the SSL-for-SaaS custom hostnames attached to the zone.
cf_list_custom_hostnames( zone_id, hostname = NULL, ssl = NULL, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_custom_hostnames( zone_id, hostname = NULL, ssl = NULL, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
hostname |
Optional hostname filter (substring match). |
ssl |
Optional SSL status filter (e.g. |
per_page, max_pages
|
Pagination controls, see
|
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of custom hostname records (or list when
as_df = FALSE).
Other ssl:
cf_create_custom_hostname(),
cf_delete_custom_hostname(),
cf_get_certificate_pack(),
cf_get_custom_hostname(),
cf_list_certificate_packs()
## Not run: cf_list_custom_hostnames("zone-1") ## End(Not run)## Not run: cf_list_custom_hostnames("zone-1") ## End(Not run)
Returns the D1 (serverless SQL) databases for the account.
cf_list_d1_databases( account_id, name = NULL, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_d1_databases( account_id, name = NULL, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
name |
Optional name filter (substring match). |
per_page, max_pages
|
Pagination controls, see
|
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of D1 database records (or list when
as_df = FALSE).
Other d1:
cf_create_d1_database(),
cf_d1_query(),
cf_delete_d1_database(),
cf_get_d1_database()
## Not run: cf_list_d1_databases("acc-1") ## End(Not run)## Not run: cf_list_d1_databases("acc-1") ## End(Not run)
List DNS records in a zone
cf_list_dns_records( zone_id, type = NULL, name = NULL, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_dns_records( zone_id, type = NULL, name = NULL, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
type |
Optional record type filter, for example |
name |
Optional record name filter. |
per_page |
Page size, see |
max_pages |
Maximum pages to retrieve, see
|
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of DNS records (or list when
as_df = FALSE).
Other dns:
cf_create_dns_record(),
cf_delete_dns_record(),
cf_get_dns_record(),
cf_update_dns_record()
cf_list_dns_records("abc123") cf_list_dns_records("abc123", type = "A")cf_list_dns_records("abc123") cf_list_dns_records("abc123", type = "A")
Returns the verified destination addresses available for routing in the account. Destinations are account-scoped, not zone-scoped, because the same destination can be used across multiple routed zones.
cf_list_email_routing_addresses( account_id, verified_only = FALSE, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_email_routing_addresses( account_id, verified_only = FALSE, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
verified_only |
Logical. When |
per_page, max_pages
|
Pagination controls. |
as_df |
Logical. See |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of destination addresses (or list when
as_df = FALSE).
Other email:
cf_get_email_routing_settings(),
cf_list_email_routing_rules()
cf_list_email_routing_addresses("abc123")cf_list_email_routing_addresses("abc123")
Returns the address-matching rules that decide how incoming emails are forwarded.
cf_list_email_routing_rules( zone_id, enabled_only = FALSE, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_email_routing_rules( zone_id, enabled_only = FALSE, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
enabled_only |
Logical. When |
per_page, max_pages
|
Pagination controls, see
|
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of routing rules (or list when
as_df = FALSE).
Other email:
cf_get_email_routing_settings(),
cf_list_email_routing_addresses()
cf_list_email_routing_rules("abc123")cf_list_email_routing_rules("abc123")
Returns the firewall rules (expression-based custom rules)
configured for the zone. This is the classic firewall-rules
endpoint; for the newer Rulesets API use cf_request() against
/zones/{id}/rulesets.
cf_list_firewall_rules( zone_id, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_firewall_rules( zone_id, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
per_page, max_pages
|
Pagination controls, see
|
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of firewall rules (or list when
as_df = FALSE). Each rule's filter nested object becomes
a list-column.
Other zones:
cf_create_page_rule(),
cf_delete_page_rule(),
cf_get_page_rule(),
cf_get_zone(),
cf_get_zone_setting(),
cf_get_zone_settings(),
cf_list_page_rules(),
cf_list_zones(),
cf_page_rule_action(),
cf_page_rule_target(),
cf_update_page_rule()
cf_list_firewall_rules("abc123")cf_list_firewall_rules("abc123")
Returns the standalone Healthchecks configured in the zone. These are separate from load-balancer pool monitors.
cf_list_healthchecks( zone_id, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_healthchecks( zone_id, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
per_page, max_pages
|
Pagination controls, see
|
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of healthcheck records (or list when
as_df = FALSE).
Other healthchecks:
cf_create_healthcheck(),
cf_delete_healthcheck(),
cf_get_healthcheck(),
cf_update_healthcheck()
## Not run: cf_list_healthchecks("zone-1") ## End(Not run)## Not run: cf_list_healthchecks("zone-1") ## End(Not run)
Walks the namespace's cursor-paginated keys endpoint and
concatenates every page into a single result. Unlike the
offset-paginated list endpoints wrapped by cf_collect(),
Cloudflare paginates KV keys with an opaque cursor, so this
wrapper keeps its own loop instead.
cf_list_kv_keys( account_id, namespace_id, prefix = NULL, limit = 1000, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_kv_keys( account_id, namespace_id, prefix = NULL, limit = 1000, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
namespace_id |
Character. KV namespace identifier. |
prefix |
Optional character. Restrict results to keys starting with this prefix. |
limit |
Integer. Page size, between 10 and 1000. |
max_pages |
Optional integer. Stop after collecting this
many pages. |
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of key records (or list when
as_df = FALSE), each with name, expiration, and
metadata (when set).
Other workers:
cf_create_kv_namespace(),
cf_delete_kv_namespace(),
cf_delete_kv_value(),
cf_delete_kv_values(),
cf_get_kv_namespace(),
cf_get_kv_value(),
cf_get_workers_script(),
cf_list_kv_namespaces(),
cf_list_workers_scripts(),
cf_put_kv_value(),
cf_put_kv_values(),
cf_rename_kv_namespace(),
cf_workers_invocations()
cf_list_kv_keys("abc123", "ns-1")cf_list_kv_keys("abc123", "ns-1")
Returns the KV namespaces in the supplied account.
cf_list_kv_namespaces( account_id, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_kv_namespaces( account_id, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
per_page, max_pages
|
Pagination controls, see
|
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of KV namespace records (or list when
as_df = FALSE).
Other workers:
cf_create_kv_namespace(),
cf_delete_kv_namespace(),
cf_delete_kv_value(),
cf_delete_kv_values(),
cf_get_kv_namespace(),
cf_get_kv_value(),
cf_get_workers_script(),
cf_list_kv_keys(),
cf_list_workers_scripts(),
cf_put_kv_value(),
cf_put_kv_values(),
cf_rename_kv_namespace(),
cf_workers_invocations()
cf_list_kv_namespaces("abc123")cf_list_kv_namespaces("abc123")
Returns the Page Rules configured for a zone (URL-pattern based overrides for cache, SSL, security, redirects, etc.).
cf_list_page_rules( zone_id, status = NULL, order = NULL, direction = NULL, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_page_rules( zone_id, status = NULL, order = NULL, direction = NULL, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
status |
Optional status filter ( |
order |
Optional ordering, see the Cloudflare API
reference. For example |
direction |
Optional sort direction, |
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of page rules (or list when
as_df = FALSE). Each rule's targets and actions are
kept as list-columns because they are themselves arrays of
nested objects.
Other zones:
cf_create_page_rule(),
cf_delete_page_rule(),
cf_get_page_rule(),
cf_get_zone(),
cf_get_zone_setting(),
cf_get_zone_settings(),
cf_list_firewall_rules(),
cf_list_zones(),
cf_page_rule_action(),
cf_page_rule_target(),
cf_update_page_rule()
cf_list_page_rules("abc123")cf_list_page_rules("abc123")
Returns the recent deployments (build history) for a Pages project, ordered by date descending.
cf_list_pages_deployments( account_id, project_name, per_page = 25, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_pages_deployments( account_id, project_name, per_page = 25, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
project_name |
Character. Pages project name. |
per_page, max_pages
|
Pagination controls. |
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of deployment records (or list when
as_df = FALSE).
Other pages:
cf_get_pages_project(),
cf_list_pages_projects()
cf_list_pages_deployments("abc123", "my-site")cf_list_pages_deployments("abc123", "my-site")
Returns the Pages projects in the supplied account. The Pages projects endpoint does not accept pagination parameters (unlike most other Cloudflare list endpoints) and returns every project in a single call.
cf_list_pages_projects( account_id, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_pages_projects( account_id, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of Pages projects (or list when
as_df = FALSE).
Other pages:
cf_get_pages_project(),
cf_list_pages_deployments()
cf_list_pages_projects("abc123")cf_list_pages_projects("abc123")
Returns the R2 object-storage buckets in the supplied account.
cf_list_r2_buckets( account_id, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_r2_buckets( account_id, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of bucket records (or list when
as_df = FALSE).
Other r2:
cf_get_r2_bucket()
cf_list_r2_buckets("abc123")cf_list_r2_buckets("abc123")
Returns the rulesets configured at the zone level. The Rulesets API is Cloudflare's modern, unified surface for firewall rules, request transforms, cache rules, rate limits, redirects, and more.
cf_list_rulesets( zone_id, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_rulesets( zone_id, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of rulesets (or list when
as_df = FALSE).
Other rulesets:
cf_get_account_ruleset(),
cf_get_ruleset(),
cf_list_account_rulesets()
cf_list_rulesets("abc123")cf_list_rulesets("abc123")
Lists sites configured with the Cloudflare Web Analytics beacon in the supplied account. Web Analytics works on any site that includes the beacon snippet, whether or not the site is proxied through Cloudflare.
cf_list_rum_sites( account_id, order_by = NULL, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_rum_sites( account_id, order_by = NULL, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
order_by |
Optional column name to sort by, for example
|
per_page, max_pages
|
Pagination controls, see
|
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of site records (or list when
as_df = FALSE).
Other analytics:
cf_cache_ratio(),
cf_dns_queries(),
cf_firewall_events_by_day(),
cf_firewall_events_top(),
cf_get_rum_site(),
cf_graphql(),
cf_rum_page_views(),
cf_rum_top(),
cf_workers_invocations(),
cf_zone_overview(),
cf_zone_requests()
cf_list_rum_sites("acc-1")cf_list_rum_sites("acc-1")
Returns the currently-connected cloudflared instances for the
tunnel.
cf_list_tunnel_connections( account_id, tunnel_id, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_tunnel_connections( account_id, tunnel_id, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
tunnel_id |
Character. Tunnel identifier. |
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of connection records (or list when
as_df = FALSE).
Other tunnels:
cf_get_tunnel(),
cf_list_tunnels()
cf_list_tunnel_connections("abc123", "tunnel-1")cf_list_tunnel_connections("abc123", "tunnel-1")
Returns the cloudflared tunnels (Zero Trust) configured in the supplied account.
cf_list_tunnels( account_id, is_deleted = FALSE, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_tunnels( account_id, is_deleted = FALSE, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
is_deleted |
Logical. When |
per_page, max_pages
|
Pagination controls, see
|
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of tunnel records (or list when
as_df = FALSE).
Other tunnels:
cf_get_tunnel(),
cf_list_tunnel_connections()
cf_list_tunnels("abc123")cf_list_tunnels("abc123")
Lists the Turnstile (Cloudflare's CAPTCHA replacement) widgets configured in an account.
cf_list_turnstile_widgets( account_id, per_page = 25, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_turnstile_widgets( account_id, per_page = 25, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
per_page, max_pages
|
Pagination controls, see
|
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of widget records (or list when
as_df = FALSE).
Other turnstile:
cf_create_turnstile_widget(),
cf_delete_turnstile_widget(),
cf_get_turnstile_widget()
cf_list_turnstile_widgets("abc123")cf_list_turnstile_widgets("abc123")
Returns the Workers scripts deployed in the supplied account.
cf_list_workers_scripts( account_id, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_workers_scripts( account_id, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of Workers script records (or list when
as_df = FALSE).
Other workers:
cf_create_kv_namespace(),
cf_delete_kv_namespace(),
cf_delete_kv_value(),
cf_delete_kv_values(),
cf_get_kv_namespace(),
cf_get_kv_value(),
cf_get_workers_script(),
cf_list_kv_keys(),
cf_list_kv_namespaces(),
cf_put_kv_value(),
cf_put_kv_values(),
cf_rename_kv_namespace(),
cf_workers_invocations()
cf_list_workers_scripts("abc123")cf_list_workers_scripts("abc123")
Lists the zones (domains) accessible to the authenticated credential.
cf_list_zones( name = NULL, status = NULL, account_id = NULL, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )cf_list_zones( name = NULL, status = NULL, account_id = NULL, per_page = 50, max_pages = Inf, as_df = TRUE, token = NULL, email = NULL, api_key = NULL )
name |
Optional zone name to filter by. |
status |
Optional status filter (for example |
account_id |
Optional account identifier to scope the listing. |
per_page |
Page size, see |
max_pages |
Maximum pages to retrieve, see
|
as_df |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame of zone records (or a list when
as_df = FALSE).
Other zones:
cf_create_page_rule(),
cf_delete_page_rule(),
cf_get_page_rule(),
cf_get_zone(),
cf_get_zone_setting(),
cf_get_zone_settings(),
cf_list_firewall_rules(),
cf_list_page_rules(),
cf_page_rule_action(),
cf_page_rule_target(),
cf_update_page_rule()
cf_list_zones() cf_list_zones(name = "example.com")cf_list_zones() cf_list_zones(name = "example.com")
Produces the nested list that the Cloudflare API expects for a
single Page Rule action. Use it inside an actions = list(...)
argument to cf_create_page_rule() or
cf_update_page_rule().
cf_page_rule_action(id, value)cf_page_rule_action(id, value)
id |
Character. The action name (Cloudflare's "setting" identifier). |
value |
The value to set. For most actions this is a
character or integer scalar; some (for example
|
Common id values: "cache_level",
"edge_cache_ttl", "browser_cache_ttl",
"always_use_https", "security_level", "ssl",
"forwarding_url".
A named list ready to splice into actions.
Other zones:
cf_create_page_rule(),
cf_delete_page_rule(),
cf_get_page_rule(),
cf_get_zone(),
cf_get_zone_setting(),
cf_get_zone_settings(),
cf_list_firewall_rules(),
cf_list_page_rules(),
cf_list_zones(),
cf_page_rule_target(),
cf_update_page_rule()
cf_page_rule_action("cache_level", "cache_everything") cf_page_rule_action("edge_cache_ttl", 7200) cf_page_rule_action( "forwarding_url", list(url = "https://example.com/$1", status_code = 301) )cf_page_rule_action("cache_level", "cache_everything") cf_page_rule_action("edge_cache_ttl", 7200) cf_page_rule_action( "forwarding_url", list(url = "https://example.com/$1", status_code = 301) )
Produces the nested list that the Cloudflare API expects for the
most common Page Rule target: a URL pattern with matches
semantics (asterisks act as wildcards). Use it inside a
targets = list(...) argument to cf_create_page_rule().
cf_page_rule_target(url_pattern)cf_page_rule_target(url_pattern)
url_pattern |
Character. The URL pattern, for example
|
A named list ready to splice into targets.
Other zones:
cf_create_page_rule(),
cf_delete_page_rule(),
cf_get_page_rule(),
cf_get_zone(),
cf_get_zone_setting(),
cf_get_zone_settings(),
cf_list_firewall_rules(),
cf_list_page_rules(),
cf_list_zones(),
cf_page_rule_action(),
cf_update_page_rule()
cf_page_rule_target("*example.com/blog/*")cf_page_rule_target("*example.com/blog/*")
Tells Cloudflare to drop cached content for a zone. Pass one
of the targeted-purge arguments to scope the purge, or set
purge_everything = TRUE to wipe the entire zone cache.
cf_purge_cache( zone_id, files = NULL, hosts = NULL, prefixes = NULL, tags = NULL, purge_everything = FALSE, token = NULL, email = NULL, api_key = NULL )cf_purge_cache( zone_id, files = NULL, hosts = NULL, prefixes = NULL, tags = NULL, purge_everything = FALSE, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
files |
Optional character vector of URLs (or list of
|
hosts |
Optional character vector of hostnames whose cached content should be invalidated. |
prefixes |
Optional character vector of URL prefixes
(without scheme) to invalidate, e.g. |
tags |
Optional character vector of cache tags (Enterprise plan). |
purge_everything |
Logical. When |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
Targeted purges are strictly preferred to wipes because cache wipes can briefly increase origin load. Cloudflare also rate limits the wipe endpoint per zone.
A named list with the purge job id.
cf_purge_cache("abc123", files = c( "https://example.com/index.html", "https://example.com/style.css" )) cf_purge_cache("abc123", purge_everything = TRUE)cf_purge_cache("abc123", files = c( "https://example.com/index.html", "https://example.com/style.css" )) cf_purge_cache("abc123", purge_everything = TRUE)
Write a value to a Workers KV namespace
cf_put_kv_value( account_id, namespace_id, key_name, value, expiration = NULL, expiration_ttl = NULL, token = NULL, email = NULL, api_key = NULL )cf_put_kv_value( account_id, namespace_id, key_name, value, expiration = NULL, expiration_ttl = NULL, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
namespace_id |
Character. KV namespace identifier. |
key_name |
Character. Key to read. |
value |
Character string or raw vector. The value to store. |
expiration |
Optional integer. Absolute expiration time as a Unix timestamp (seconds). |
expiration_ttl |
Optional integer. Expiration in seconds from now (minimum 60). |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
TRUE, invisibly, on success.
Other workers:
cf_create_kv_namespace(),
cf_delete_kv_namespace(),
cf_delete_kv_value(),
cf_delete_kv_values(),
cf_get_kv_namespace(),
cf_get_kv_value(),
cf_get_workers_script(),
cf_list_kv_keys(),
cf_list_kv_namespaces(),
cf_list_workers_scripts(),
cf_put_kv_values(),
cf_rename_kv_namespace(),
cf_workers_invocations()
cf_put_kv_value("abc123", "ns-1", "greeting", "hello world")cf_put_kv_value("abc123", "ns-1", "greeting", "hello world")
Write multiple key-value pairs to a Workers KV namespace
cf_put_kv_values( account_id, namespace_id, values, token = NULL, email = NULL, api_key = NULL )cf_put_kv_values( account_id, namespace_id, values, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
namespace_id |
Character. KV namespace identifier. |
values |
A list of entries, each a named list with a |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list with successful_key_count and
unsuccessful_keys.
Other workers:
cf_create_kv_namespace(),
cf_delete_kv_namespace(),
cf_delete_kv_value(),
cf_delete_kv_values(),
cf_get_kv_namespace(),
cf_get_kv_value(),
cf_get_workers_script(),
cf_list_kv_keys(),
cf_list_kv_namespaces(),
cf_list_workers_scripts(),
cf_put_kv_value(),
cf_rename_kv_namespace(),
cf_workers_invocations()
cf_put_kv_values( "abc123", "ns-1", list( list(key = "greeting", value = "hello"), list(key = "farewell", value = "bye", expiration_ttl = 3600) ) )cf_put_kv_values( "abc123", "ns-1", list( list(key = "greeting", value = "hello"), list(key = "farewell", value = "bye", expiration_ttl = 3600) ) )
Helper that takes a list of named records (typically the result
array from a Cloudflare REST endpoint) and returns a data.frame
with one row per record. Scalar fields become typed columns;
vector- or object-valued fields become list-columns.
cf_records_to_df(records)cf_records_to_df(records)
records |
A list of named lists with broadly consistent
field names. Missing fields become |
A data.frame with one row per record and columns named by the union of field names. Empty input returns an empty data.frame.
records <- list( list(id = "a", name = "alpha", tags = c("x", "y")), list(id = "b", name = "beta", tags = character(0)) ) cf_records_to_df(records)records <- list( list(id = "a", name = "alpha", tags = c("x", "y")), list(id = "b", name = "beta", tags = character(0)) ) cf_records_to_df(records)
Rename a Workers KV namespace
cf_rename_kv_namespace( account_id, namespace_id, title, token = NULL, email = NULL, api_key = NULL )cf_rename_kv_namespace( account_id, namespace_id, title, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier. |
namespace_id |
Character. KV namespace identifier. |
title |
Character. New namespace name. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the renamed namespace.
Other workers:
cf_create_kv_namespace(),
cf_delete_kv_namespace(),
cf_delete_kv_value(),
cf_delete_kv_values(),
cf_get_kv_namespace(),
cf_get_kv_value(),
cf_get_workers_script(),
cf_list_kv_keys(),
cf_list_kv_namespaces(),
cf_list_workers_scripts(),
cf_put_kv_value(),
cf_put_kv_values(),
cf_workers_invocations()
cf_rename_kv_namespace("abc123", "ns-1", "sessions-v2")cf_rename_kv_namespace("abc123", "ns-1", "sessions-v2")
Returns an httr2 request with credentials, headers, and the
endpoint path attached, ready to be piped through httr2 request
modifiers (httr2::req_method(), httr2::req_url_query(),
httr2::req_body_json()) and performed with
httr2::req_perform(). Pair the performed response with
cf_resp() to unwrap the standard Cloudflare envelope, or pipe
the request into cf_collect() to walk a paginated list
endpoint. This is the base that every dedicated wrapper in the
package builds on, and the entry point for calling any endpoint
that does not yet have one.
cf_request(endpoint, token = NULL, email = NULL, api_key = NULL)cf_request(endpoint, token = NULL, email = NULL, api_key = NULL)
endpoint |
Path relative to the API base URL, without a
leading slash. Either a single string (for example |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
An httr2_request.
Other requests:
cf_collect(),
cf_resp()
cf_request("user/tokens/verify") |> httr2::req_perform() |> cf_resp() cf_request(c("zones", "abc123", "dns_records")) |> httr2::req_method("POST") |> httr2::req_body_json( list(type = "A", name = "example.com", content = "192.0.2.1") ) |> httr2::req_perform() |> cf_resp() cf_request("zones") |> httr2::req_url_query(status = "active") |> cf_collect(per_page = 50)cf_request("user/tokens/verify") |> httr2::req_perform() |> cf_resp() cf_request(c("zones", "abc123", "dns_records")) |> httr2::req_method("POST") |> httr2::req_body_json( list(type = "A", name = "example.com", content = "192.0.2.1") ) |> httr2::req_perform() |> cf_resp() cf_request("zones") |> httr2::req_url_query(status = "active") |> cf_collect(per_page = 50)
Validates the standard Cloudflare envelope on a performed
response and returns its result payload. Typically the terminal
step of a request pipeline built with cf_request() and
httr2::req_perform().
cf_resp(resp)cf_resp(resp)
resp |
An |
The Cloudflare API wraps every response in an envelope with
success, errors, messages, result, and (for paginated
endpoints) result_info. API-level failures – both HTTP error
statuses and envelope errors (HTTP 200 with success: false) –
raise a classed condition you can catch with
tryCatch(..., cloudflarer_error = ...). Transport-level failures
that never reach the API (DNS resolution, connection refused,
timeout) surface as the underlying httr2 error instead.
The parsed result element from the response. For
single-resource endpoints this is a named list; for collection
endpoints it is a list of records.
Other requests:
cf_collect(),
cf_request()
cf_request("user") |> httr2::req_perform() |> cf_resp()cf_request("user") |> httr2::req_perform() |> cf_resp()
Convenience wrapper around the GraphQL
rumPageloadEventsAdaptiveGroups node with a daily
(date_DAY) dimension. Returns a tidy data.frame.
cf_rum_page_views( account_id, site_tag, since, until, limit = 100L, token = NULL, email = NULL, api_key = NULL )cf_rum_page_views( account_id, site_tag, since, until, limit = 100L, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier
( |
site_tag |
Character. RUM site tag, as returned by
|
since, until
|
Date or |
limit |
Maximum number of days to return. Cloudflare caps the underlying query at 10000. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame with one row per day and columns
date (chr) and pageviews (int).
Other analytics:
cf_cache_ratio(),
cf_dns_queries(),
cf_firewall_events_by_day(),
cf_firewall_events_top(),
cf_get_rum_site(),
cf_graphql(),
cf_list_rum_sites(),
cf_rum_top(),
cf_workers_invocations(),
cf_zone_overview(),
cf_zone_requests()
cf_rum_page_views( "acc-1", site_tag = "abc", since = Sys.Date() - 30, until = Sys.Date() )cf_rum_page_views( "acc-1", site_tag = "abc", since = Sys.Date() - 30, until = Sys.Date() )
Generic wrapper that groups RUM page-load events by a single dimension (country, path, referer, browser, OS, device type, ...) and returns the top entries by count.
cf_rum_top( account_id, site_tag, since, until, dimension = "countryName", limit = 25L, token = NULL, email = NULL, api_key = NULL )cf_rum_top( account_id, site_tag, since, until, dimension = "countryName", limit = 25L, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier
( |
site_tag |
Character. RUM site tag, as returned by
|
since, until
|
Date or |
dimension |
Character. A dimension name supported by
|
limit |
Number of rows to return (default 25). |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame with two columns: the requested
dimension and count.
Other analytics:
cf_cache_ratio(),
cf_dns_queries(),
cf_firewall_events_by_day(),
cf_firewall_events_top(),
cf_get_rum_site(),
cf_graphql(),
cf_list_rum_sites(),
cf_rum_page_views(),
cf_workers_invocations(),
cf_zone_overview(),
cf_zone_requests()
cf_rum_top( "acc-1", site_tag = "abc", since = Sys.Date() - 7, until = Sys.Date(), dimension = "countryName", limit = 10 )cf_rum_top( "acc-1", site_tag = "abc", since = Sys.Date() - 7, until = Sys.Date(), dimension = "countryName", limit = 10 )
Prints a short summary of the package version, which auth mode
is configured (cf_auth_mode()), and whether the configured
credentials successfully authenticate against the Cloudflare API.
Use this as a first stop when debugging configuration issues.
cf_sitrep()cf_sitrep()
Invisibly, a list with the diagnostic results.
Other authentication:
cf_api_key(),
cf_auth_mode(),
cf_email(),
cf_has_auth(),
cf_token(),
cf_verify()
cf_sitrep()cf_sitrep()
Returns the modern Cloudflare API token. By default reads from
the CLOUDFLARE_API_TOKEN environment variable. See
vignette("authentication", package = "cloudflarer") for guidance
on creating a token and storing it safely.
cf_token(token = NULL)cf_token(token = NULL)
token |
Character. An API token. If |
A character scalar with the API token.
Other authentication:
cf_api_key(),
cf_auth_mode(),
cf_email(),
cf_has_auth(),
cf_sitrep(),
cf_verify()
withr::with_envvar( c(CLOUDFLARE_API_TOKEN = "cloudflarer-example"), cf_token() )withr::with_envvar( c(CLOUDFLARE_API_TOKEN = "cloudflarer-example"), cf_token() )
Performs a PATCH on the record, only sending fields supplied
as non-NULL. Use a PUT-style replace via cf_request() if
you need to overwrite the entire record.
cf_update_dns_record( zone_id, record_id, type = NULL, name = NULL, content = NULL, ttl = NULL, proxied = NULL, priority = NULL, comment = NULL, ..., token = NULL, email = NULL, api_key = NULL )cf_update_dns_record( zone_id, record_id, type = NULL, name = NULL, content = NULL, ttl = NULL, proxied = NULL, priority = NULL, comment = NULL, ..., token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
record_id |
Character. DNS record identifier. |
type |
Record type: |
name |
Record name (host). For the apex, pass |
content |
Record content. For |
ttl |
Time to live in seconds. |
proxied |
Logical. Whether the record is proxied through Cloudflare. Applies to A/AAAA/CNAME. |
priority |
Integer. Required for |
comment |
Optional human-readable comment. |
... |
Additional fields forwarded to the API for record
types with extra requirements ( |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the updated record.
Other dns:
cf_create_dns_record(),
cf_delete_dns_record(),
cf_get_dns_record(),
cf_list_dns_records()
cf_update_dns_record("zone-1", "rec-1", content = "192.0.2.2")cf_update_dns_record("zone-1", "rec-1", content = "192.0.2.2")
Performs a PATCH, sending only fields supplied as non-NULL.
cf_update_healthcheck( zone_id, healthcheck_id, name = NULL, address = NULL, type = NULL, check_regions = NULL, http_config = NULL, tcp_config = NULL, interval = NULL, retries = NULL, timeout = NULL, description = NULL, suspended = NULL, ..., token = NULL, email = NULL, api_key = NULL )cf_update_healthcheck( zone_id, healthcheck_id, name = NULL, address = NULL, type = NULL, check_regions = NULL, http_config = NULL, tcp_config = NULL, interval = NULL, retries = NULL, timeout = NULL, description = NULL, suspended = NULL, ..., token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
healthcheck_id |
Character. Healthcheck identifier. |
name |
Display name for the healthcheck. |
address |
Hostname or IPv4/IPv6 address to monitor. |
type |
One of |
check_regions |
Optional character vector of Cloudflare region
codes ( |
http_config |
Optional named list with HTTP/HTTPS-specific
fields ( |
tcp_config |
Optional named list with TCP-specific fields
( |
interval |
Polling interval in seconds. |
retries |
Number of retries before marking unhealthy. |
timeout |
Timeout per check, in seconds. |
description |
Optional human-readable description. |
suspended |
Logical. When |
... |
Additional fields forwarded to the API. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the updated healthcheck.
Other healthchecks:
cf_create_healthcheck(),
cf_delete_healthcheck(),
cf_get_healthcheck(),
cf_list_healthchecks()
## Not run: cf_update_healthcheck("zone-1", "hc-1", suspended = TRUE) ## End(Not run)## Not run: cf_update_healthcheck("zone-1", "hc-1", suspended = TRUE) ## End(Not run)
Performs a PATCH. Only supply fields you want to change.
Targets and actions are full replacements when supplied.
cf_update_page_rule( zone_id, rule_id, targets = NULL, actions = NULL, priority = NULL, status = NULL, token = NULL, email = NULL, api_key = NULL )cf_update_page_rule( zone_id, rule_id, targets = NULL, actions = NULL, priority = NULL, status = NULL, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
rule_id |
Character. Page Rule identifier. |
targets |
A list of target specifications. The simplest
form is a single URL-match created by |
actions |
A list of action specifications. The simplest
form is a list created by |
priority |
Integer. Higher number = applied first. |
status |
|
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list describing the updated rule.
Other zones:
cf_create_page_rule(),
cf_delete_page_rule(),
cf_get_page_rule(),
cf_get_zone(),
cf_get_zone_setting(),
cf_get_zone_settings(),
cf_list_firewall_rules(),
cf_list_page_rules(),
cf_list_zones(),
cf_page_rule_action(),
cf_page_rule_target()
cf_update_page_rule("abc123", "rule-1", status = "disabled")cf_update_page_rule("abc123", "rule-1", status = "disabled")
Returns information about the user that owns the API token.
cf_user(token = NULL)cf_user(token = NULL)
token |
Character. An API token. If |
A named list of user fields, including id, email,
first_name, last_name, and organizations.
cf_user()cf_user()
For token auth, calls /user/tokens/verify and returns the token
record. For Global API Key auth, calls /user and returns the
user record (the verify endpoint is token-only). Either way, a
successful return means the credential authenticates against the
API.
cf_verify(token = NULL, email = NULL, api_key = NULL) cf_token_verify(token = NULL)cf_verify(token = NULL, email = NULL, api_key = NULL) cf_token_verify(token = NULL)
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A named list. The shape depends on the auth mode.
Other authentication:
cf_api_key(),
cf_auth_mode(),
cf_email(),
cf_has_auth(),
cf_sitrep(),
cf_token()
cf_verify()cf_verify()
Wraps the Cloudflare GraphQL workersInvocationsAdaptive node
to return a tidy data.frame with one row per time bin and one
row per Worker script.
cf_workers_invocations( account_id, since, until, script_name = NULL, limit = 100L, token = NULL, email = NULL, api_key = NULL )cf_workers_invocations( account_id, since, until, script_name = NULL, limit = 100L, token = NULL, email = NULL, api_key = NULL )
account_id |
Character. Cloudflare account identifier
( |
since, until
|
Date or |
script_name |
Optional Worker script name filter. |
limit |
Maximum number of rows. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
Requires an API token with Account Analytics: Read (or the
legacy Global API Key).
A data.frame with columns date, script, requests,
errors, subrequests, duration_ms.
Other analytics:
cf_cache_ratio(),
cf_dns_queries(),
cf_firewall_events_by_day(),
cf_firewall_events_top(),
cf_get_rum_site(),
cf_graphql(),
cf_list_rum_sites(),
cf_rum_page_views(),
cf_rum_top(),
cf_zone_overview(),
cf_zone_requests()
Other workers:
cf_create_kv_namespace(),
cf_delete_kv_namespace(),
cf_delete_kv_value(),
cf_delete_kv_values(),
cf_get_kv_namespace(),
cf_get_kv_value(),
cf_get_workers_script(),
cf_list_kv_keys(),
cf_list_kv_namespaces(),
cf_list_workers_scripts(),
cf_put_kv_value(),
cf_put_kv_values(),
cf_rename_kv_namespace()
cf_workers_invocations( "acc-1", since = Sys.Date() - 7, until = Sys.Date() )cf_workers_invocations( "acc-1", since = Sys.Date() - 7, until = Sys.Date() )
Bundles the most-used analytics endpoints into a single call
and returns a named list of tidy data.frames covering traffic,
cache effectiveness, DNS queries, firewall events, and (when
site_tag is supplied) Web Analytics top countries.
cf_zone_overview( zone_id, since = Sys.Date() - 7, until = Sys.Date(), account_id = NULL, site_tag = NULL, token = NULL, email = NULL, api_key = NULL )cf_zone_overview( zone_id, since = Sys.Date() - 7, until = Sys.Date(), account_id = NULL, site_tag = NULL, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier. |
since, until
|
Date or |
account_id |
Optional account identifier. Required for the
|
site_tag |
Optional Web Analytics site tag. Required for
the |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
Each underlying call is wrapped in tryCatch(), so an
individual failure (Free-plan gating, missing permission,
empty data) yields NULL for that component instead of
aborting the whole overview.
A named list with class cloudflarer_overview:
traffic – daily requests, bytes, page views, threats,
uniques (from cf_zone_requests()).
cache – daily cache hit ratios (from cf_cache_ratio()).
dns – daily DNS query counts (from cf_dns_queries()).
firewall – daily firewall event counts (from
cf_firewall_events_by_day(); Pro+ plans only).
top_countries – top countries by RUM page views (from
cf_rum_top()); only populated when account_id and
site_tag are supplied.
summary – a one-row data.frame with the period totals.
zone_id, since, until – the call's own arguments,
echoed back for reference.
Other analytics:
cf_cache_ratio(),
cf_dns_queries(),
cf_firewall_events_by_day(),
cf_firewall_events_top(),
cf_get_rum_site(),
cf_graphql(),
cf_list_rum_sites(),
cf_rum_page_views(),
cf_rum_top(),
cf_workers_invocations(),
cf_zone_requests()
ov <- cf_zone_overview(zone_id, account_id = account_id, site_tag = site_tag) ov$traffic ov$summaryov <- cf_zone_overview(zone_id, account_id = account_id, site_tag = site_tag) ov$traffic ov$summary
Convenience wrapper around the Cloudflare GraphQL Analytics
httpRequests1dGroups (daily) or httpRequests1hGroups
(hourly) nodes. Returns a tidy data.frame with one row per time
bin and columns for requests, bytes, page views, threats, and
unique visitors.
cf_zone_requests( zone_id, since, until, by = c("day", "hour"), limit = 100L, token = NULL, email = NULL, api_key = NULL )cf_zone_requests( zone_id, since, until, by = c("day", "hour"), limit = 100L, token = NULL, email = NULL, api_key = NULL )
zone_id |
Character. Cloudflare zone identifier
( |
since, until
|
Date or |
by |
Bin width: |
limit |
Maximum number of bins to return. Cloudflare caps the GraphQL query at 10000. |
token |
Character. An API token. If |
email |
Character. Account email. If |
api_key |
Character. The Global API Key. If |
A data.frame with columns:
date (chr; "YYYY-MM-DD" for daily, "YYYY-MM-DDTHH:00:00Z"
for hourly), requests, bytes, pageviews, threats,
uniques.
Other analytics:
cf_cache_ratio(),
cf_dns_queries(),
cf_firewall_events_by_day(),
cf_firewall_events_top(),
cf_get_rum_site(),
cf_graphql(),
cf_list_rum_sites(),
cf_rum_page_views(),
cf_rum_top(),
cf_workers_invocations(),
cf_zone_overview()
cf_zone_requests( "abc123", since = Sys.Date() - 7, until = Sys.Date(), by = "day" ) cf_zone_requests( "abc123", since = Sys.time() - 24 * 3600, until = Sys.time(), by = "hour" )cf_zone_requests( "abc123", since = Sys.Date() - 7, until = Sys.Date(), by = "day" ) cf_zone_requests( "abc123", since = Sys.time() - 24 * 3600, until = Sys.time(), by = "hour" )