A WordPress API library for accessing the Cloudflare API.
version | 1.1.0 |
---|---|
link | API Documentation |
package | WP-API-Libraries\WP-IDX-Cloudflare-API |
author | Santiago Garza |
author | imFORZA |
__construct(string $api_key, string $auth_email, string $user_service_key = ''
)
string
Cloudflare API Key.
string
Email associated to the account.
string
User Service key.
change_zone_pagerule(string $id, string $pr_id, array $targets= null
, array $actions= null
, integer $priority= null
, string $status= null
) : array
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
string
Page rule ID.
array
Targets to evaluate on a request. See API docs for details.
array
The set of actions to perform if the targets of this rule match the request. Actions can redirect the url to another url or override settings (but not both).
integer
A number that indicates the preference for a page rule over another. In the case where you may have a catch-all page rule (e.g., #1: '/images/') but want a rule that is more specific to take precedence (e.g., #2: '/images/special/'), you'll want to specify a higher priority on the latter (#2) so it will override the first. Default: 1.
string
Status of the page rule. Default: disabled. Valid Values: active, disabled.
array
Page rule info.connect_zone_railguns()
create_user_accesss_rule(string $mode, string $config_target, string $config_value, string $notes = ''
) : array
Make a new IP, IP range, or country access rule for all zones owned by the user. Note: If you would like to create an access rule that applies to a specific zone only, use the zone firewall endpoints.
api | POST |
---|---|
see | Documentation |
string
The action to apply to a matched request. Valid values: block, challenge, whitelist.
string
Rule configuration target. valid values: ip, ip_range, country.
string
Rule configuration value. See API docs for details.
string
A personal note about the rule. Typically used as a reminder or explanation for the rule.
array
New access rule info.create_zone(string $domain, boolean $jump_start= ''
, array $org= array()
) : array
api | POST |
---|---|
see | Documentation |
string
The domain name. i.e. "example.com".
boolean
Automatically attempt to fetch existing DNS records.
array
To create a zone owned by an organization, specify the organization parameter. Organization objects can be found in the User or User's Organizations endpoints. You must pass at least the ID of the organization.
array
New zone details.create_zone_dns_record(string $id, string $type, string $name, string $content, integer $ttl= null
, boolean $proxied= null
) : array
Create a new DNS record for a zone. See the record object definitions for required attributes for each record type.
api | POST |
---|---|
see | Documentation |
string
Zone ID.
string
DNS record type, i.e "A".
string
DNS record name, i.e "example.com".
string
DNS record content, i.e "127.0.0.1".
integer
Time to live for DNS record. Value of 1 is 'automatic'.
boolean
Whether the record is receiving the performance and security benefits of Cloudflare.
array
The new DNS recordcreate_zone_pagerules(string $id, array $targets, array $actions, integer $priority= null
, string $status= null
) : array
api | POST |
---|---|
see | Documentation |
string
Zone ID.
array
Targets to evaluate on a request. See API docs for details.
array
The set of actions to perform if the targets of this rule match the request. Actions can redirect the url to another url or override settings (but not both).
integer
A number that indicates the preference for a page rule over another. In the case where you may have a catch-all page rule (e.g., #1: '/images/') but want a rule that is more specific to take precedence (e.g., #2: '/images/special/'), you'll want to specify a higher priority on the latter (#2) so it will override the first. Default: 1.
string
Status of the page rule. Default: disabled. Valid Values: active, disabled.
array
Page rule info.delete_user_accesss_rule(string $id) : array
Remove an access rule so it is no longer evaluated during requests. This will apply to all zones owned by the user.
api | DELETE |
---|---|
see | Documentation |
string
Subscription identifier tag.
array
Array with deleted access rule ID.delete_user_subscriptions(string $subscription_id) : array
api | DELETE |
---|---|
see | Documentation |
string
Subscription identifier tag.
array
JSON array with deleted subscription ID.delete_zone(string $id) : array
delete_zone_dns_record(string $id, string $dns_id) : array
api | DELETE |
---|---|
see | Documentation |
string
Zone ID.
string
DNS record ID.
array
Array of results.delete_zone_pagerule(string $id, string $pr_id) : array
api | DELETE |
---|---|
see | Documentation |
string
Zone ID.
string
Page rule ID.
array
Delted page rule.get_user() : array
Account Access: FREE, PRO, Business, Enterprise
api | GET |
---|---|
see | Documentation. |
access | public |
array
User information.get_user_access_rules(array $args = array()
) : array
Search, sort, and filter IP/country access rules
api | GET |
---|---|
see | Documentation |
array
Array with optional parameters. See API docs for details.
array
List of user-level firewall access rules.get_user_billing_history() : array
get_user_billing_profile() : array
Account Access: FREE, PRO, Business, Enterprise
api | GET |
---|---|
see | Documentation. |
access | public |
array
User billing profile.get_user_invite_details(string $id) : array
Get a specific organization the user is associated with.
api | GET |
---|---|
see | Documentation |
string
Invite id.
array
Array with invites details.get_user_invites() : array
List all invitations associated with my user.
api | GET |
---|---|
see | Documentation |
array
List of user invitesget_user_org_details(string $id) : array
Get a specific organization the user is associated with.
api | GET |
---|---|
see | Documentation |
string
Organization id.
array
Array with org details.get_user_orgs(array $args = array()
) : array
List organizations the user is associated with.
api | GET |
---|---|
see | Documentation |
array
Array with optional parameters. See API docs for details.
array
List of user organizations.get_user_subscriptions() : array
get_zone_analytics_colocations()
get_zone_analytics_dashboard(string $id, array $args = array()
) : array
The dashboard view provides both totals and timeseries data for the given zone and time period across the entire Cloudflare network.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Array with optional parameters. See API docs for details.
array
List of zone analytics.get_zone_available_rate_plans(string $id) : array
List all rate plans the zone can subscribe to.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Available rate plan info.get_zone_custom_page_details(string $id, string $page_id) : array
Details about a specific Custom page details.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
string
Custom page ID.
array
Custom page info.get_zone_custom_pages(string $id) : array
A list of available Custom Pages the zone can use.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Array of custom pages.get_zone_dns_analytics(string $id, array $dimensions, array $metrics, string $since, string $until, array $sort= null
, array $filters= null
, array $limit= null
) : array
Retrieves a list of summarised aggregate metrics over a given time period.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Array of dimensions
array
Array of metrics
string
Start date and time of requesting data period in the ISO8601 format
string
End date and time of requesting data period in the ISO8601 format
array
Array of dimensions to sort by, each dimension may be prefixed by - (descending) or + (ascending)
array
Segmentation filter in 'attribute operator value' format
array
Limit number of returned metrics, default is 100
array
DNS analytics report.get_zone_dns_analytics_bytime(string $id, array $dimensions= null
, array $metrics= null
, string $since= null
, string $until= null
, array $sort= null
, array $filters= null
, array $limit= null
, array $time_delta= null
) : array
Retrieves a list of aggregate metrics grouped by time interval.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Array of dimensions
array
Array of metrics
string
Start date and time of requesting data period in the ISO8601 format
string
End date and time of requesting data period in the ISO8601 format
array
Array of dimensions to sort by, each dimension may be prefixed by - (descending) or + (ascending)
array
Segmentation filter in 'attribute operator value' format
array
Limit number of returned metrics, default is 100
array
Unit of time to group data by. Valid values: all, auto, year, quarter, month, week, day, hour, dekaminute, minute.
array
DNS analytics report by time.get_zone_dns_record_details(string $id, string $dns_id) : array
Get details of a single DNS record.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
string
DNS record ID.
array
Array of DNS record info.get_zone_dns_records(string $id, array $args = array()
) : array
Search, sort, and filter IP/country access rules.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Array with optional parameters. See API docs for details.
array
List of DNS records.get_zone_pagerule_details(string $id, string $pr_id) : array
api | GET |
---|---|
see | Documentation |
string
Zone ID.
string
Page rule ID.
array
Page rule info.get_zone_pagerules(string $id, string $status= null
, string $order= null
, string $direction= null
, string $match= null
) : array
api | GET |
---|---|
see | Documentation |
string
Zone ID.
string
Status of the page rule. Default: disabled. Valid values: active, disabled.
string
Field to order page rules by. Default: priority. Valid values: status, priority.
string
Direction to order page rules. Default: desc. Valid values: asc, desc.
string
Whether to match all search requirements or at least one (any). Default: all. Valid values: any, all.
array
List of page rules.get_zone_railgun_details()
get_zone_railguns()
get_zone_settings(string $id) : array
Available settings for your user in relation to a zone
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Zone setting info.get_zone_settings_advanced_ddos()
get_zone_settings_always_online(string $id) : array
When enabled, Always Online will serve pages from our cache if your server is offline (https://support.cloudflare.com/hc/en-us/articles/200168006)
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Always online setting info.get_zone_settings_always_use_https(string $id) : array
Reply to all requests for URLs that use "http" with a 301 redirect to the equivalent "https" URL. If you only want to redirect for a subset of requests, consider creating an "Always use HTTPS" page rule.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Always online setting info.get_zone_settings_automatic_https_rewrites(string $id) : array
Enable the Automatic HTTPS Rewrites feature for this zone.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Auto https rewrites setting info.get_zone_settings_browser_cache_ttl(string $id) : array
Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources will remain on your visitors' computers. Cloudflare will honor any larger times specified by your server. (https://support.cloudflare.com/hc/en-us/articles/200168276).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Browser cache ttl setting info.get_zone_settings_browser_check(string $id) : array
Browser Integrity Check is similar to Bad Behavior and looks for common HTTP headers abused most commonly by spammers and denies access to your page. It will also challenge visitors that do not have a user agent or a non standard user agent (also commonly used by abuse bots, crawlers or visitors). (https://support.cloudflare.com/hc/en-us/articles/200170086).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Browser check info.get_zone_settings_cache_level(string $id) : array
Cache Level functions based off the setting level. The basic setting will cache most static resources (i.e., css, images, and JavaScript). The simplified setting will ignore the query string when delivering a cached resource. The aggressive setting will cache all static resources, including ones with a query string. (https://support.cloudflare.com/hc/en-us/articles/200168256).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Cache level seting info.get_zone_settings_challenge_ttl(string $id) : array
Specify how long a visitor is allowed access to your site after successfully completing a challenge (such as a CAPTCHA). After the TTL has expired the visitor will have to complete a new challenge. We recommend a 15 - 45 minute setting and will attempt to honor any setting above 45 minutes. (https://support.cloudflare.com/hc/en-us/articles/200170136).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Challenge TTL setting info.get_zone_settings_development_mode(string $id) : array
Development Mode temporarily allows you to enter development mode for your websites if you need to make changes to your site. This will bypass Cloudflare's accelerated cache and slow down your site, but is useful if you are making changes to cacheable content (like images, css, or JavaScript) and would like to see those changes right away. Once entered, development mode will last for 3 hours and then automatically toggle off.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Development mode setting info.get_zone_settings_email_obfuscation(string $id) : array
Encrypt email adresses on your web page from bots, while keeping them visible to humans. (https://support.cloudflare.com/hc/en-us/articles/200170016).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Email obfuscation setting info.get_zone_settings_hotlink_protection(string $id) : array
When enabled, the Hotlink Protection option ensures that other sites cannot suck up your bandwidth by building pages that use images hosted on your site. Anytime a request for an image on your site hits Cloudflare, we check to ensure that it's not another site requesting them. People will still be able to download and view images from your page, but other sites won't be able to steal them for use on their own pages. (https://support.cloudflare.com/hc/en-us/articles/200170026).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Hotlink protection setting info.get_zone_settings_http2(string $id) : array
Value of the HTTP2 setting.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
HTTP2 setting info.get_zone_settings_ip_geolocation(string $id) : array
Enable IP Geolocation to have Cloudflare geolocate visitors to your website and pass the country code to you. (https://support.cloudflare.com/hc/en-us/articles/200168236).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Hotlink protection setting info.get_zone_settings_ipv6(string $id) : array
Enable IPv6 on all subdomains that are Cloudflare enabled. (https://support.cloudflare.com/hc/en-us/articles/200168586).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Ipv6 setting info.get_zone_settings_minify(string $id) : array
Automatically minify certain assets for your website (https://support.cloudflare.com/hc/en-us/articles/200168196).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Minify setting info.get_zone_settings_mirage(string $id) : array
Automatically optimize image loading for website visitors on mobile devices (http://blog.cloudflare.com/mirage2-solving-mobile-speed).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Mirage setting info.get_zone_settings_mobile_redirect(string $id) : array
Automatically redirect visitors on mobile devices to a mobile-optimized subdomain (https://support.cloudflare.com/hc/en-us/articles/200168336).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Mobile redirect setting info.get_zone_settings_opportunistic_encryption(string $id) : array
Enable the Opportunistic Encryption feature for this zone.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Opportunistic encryption setting info.get_zone_settings_origin_error_page_pass_thru()
get_zone_settings_polish(string $id) : array
Strips metadata and compresses your images for faster page load times. Basic (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster image loading. Larger JPEGs are converted to progressive images, loading a lower-resolution image first and ending in a higher-resolution version. Not recommended for hi-res photography sites.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Polish setting info.get_zone_settings_prefetch_preload(string $id) : array
Cloudflare will prefetch any URLs that are included in the response headers. This is limited to Enterprise Zones.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Prefetch Preload setting info.get_zone_settings_pseudo_ipv4(string $id) : array
Value of the pseudo_ipv4 setting.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Pseudo ipv4 setting info.get_zone_settings_response_buffering()
get_zone_settings_rocket_loader(string $id) : array
Rocket Loader is a general-purpose asynchronous JavaScript loader coupled with a lightweight virtual browser which can safely run any JavaScript code after window.onload. Turning on Rocket Loader will immediately improve a web page's window.onload time (assuming there is JavaScript on the page), which can have a positive impact on your Google search ranking. Automatic Mode: Rocket Loader will automatically run on the JavaScript resources on your site, with no configuration required after turning on automatic mode. Manual Mode: In order to have Rocket Loader execute for a particular script, you must add the following attribute to the script tag: "data-cfasync='true'". As your page passes through Cloudflare, we'll enable Rocket Loader for that particular script. All other JavaScript will continue to execute without Cloudflare touching the script. (https://support.cloudflare.com/hc/en-us/articles/200168056).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Rocket Loader setting info.get_zone_settings_security_header(string $id) : array
Cloudflare security header for a zone.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Security header setting info.get_zone_settings_security_level(string $id) : array
Choose the appropriate security profile for your website, which will automatically adjust each of the security settings. If you choose to customize an individual security setting, the profile will become Custom. (https://support.cloudflare.com/hc/en-us/articles/200170056).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Security level setting info.get_zone_settings_server_side_exclude(string $id) : array
If there is sensitive content on your website that you want visible to real visitors, but that you want to hide from suspicious visitors, all you have to do is wrap the content with Cloudflare SSE tags. Wrap any content that you want to be excluded from suspicious visitors in the following SSE tags: . For example: Bad visitors won't see my phone number, 555-555-5555 . Note: SSE only will work with HTML. If you have HTML minification enabled, you won't see the SSE tags in your HTML source when it's served through Cloudflare. SSE will still function in this case, as Cloudflare's HTML minification and SSE functionality occur on-the-fly as the resource moves through our network to the visitor's computer. (https://support.cloudflare.com/hc/en-us/articles/200170036).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Server side exclude setting info.get_zone_settings_sort_query_string_for_cache()
get_zone_settings_ssl(string $id) : array
SSL encrypts your visitor's connection and safeguards credit card numbers and other personal data to and from your website. SSL can take up to 5 minutes to fully activate. Requires Cloudflare active on your root domain or www domain. Off: no SSL between the visitor and Cloudflare, and no SSL between Cloudflare and your web server (all HTTP traffic). Flexible: SSL between the visitor and Cloudflare -- visitor sees HTTPS on your site, but no SSL between Cloudflare and your web server. You don't need to have an SSL cert on your web server, but your vistors will still see the site as being HTTPS enabled. Full: SSL between the visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and your web server. You'll need to have your own SSL cert or self-signed cert at the very least. Full (Strict): SSL between the visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and your web server. You'll need to have a valid SSL certificate installed on your web server. This certificate must be signed by a certificate authority, have an expiration date in the future, and respond for the request domain name (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
SSL setting info.get_zone_settings_tls_1_2_only()
get_zone_settings_tls_1_3(string $id) : array
Enable Crypto TLS 1.3 feature for this zone.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
TLS 1.3 setting info.get_zone_settings_tls_client_auth(string $id) : array
TLS Client Auth requires Cloudflare to connect to your origin server using a client certificate (Enterprise Only).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
TLS Client Auth setting info.get_zone_settings_true_client_ip_header()
get_zone_settings_waf(string $id) : array
The WAF examines HTTP requests to your website. It inspects both GET and POST requests and applies rules to help filter out illegitimate traffic from legitimate website visitors. The Cloudflare WAF inspects website addresses or URLs to detect anything out of the ordinary. If the Cloudflare WAF determines suspicious user behavior, then the WAF will ‘challenge’ the web visitor with a page that asks them to submit a CAPTCHA successfully to continue their action. If the challenge is failed, the action will be stopped. What this means is that Cloudflare’s WAF will block any traffic identified as illegitimate before it reaches your origin web server. (https://support.cloudflare.com/hc/en-us/articles/200172016).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Web application firewall setting info.get_zone_settings_webp(string $id) : array
When the client requesting the image supports the WebP image codec, Cloudflare will serve a WebP version of the image when WebP offers a performance advantage over the original image format.
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
WebP setting info.get_zone_settings_websockets(string $id) : array
WebSockets are open connections sustained between the client and the origin server. Inside a WebSockets connection, the client and the origin can pass data back and forth without having to reestablish sessions. This makes exchanging data within a WebSockets connection fast. WebSockets are often used for real-time applications such as live chat and gaming. (https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-).
api | GET |
---|---|
see | Documentation |
string
Zone ID.
array
Websockets setting info.get_zones(array $args = array()
) : array
List, search, sort, and filter your zones.
api | GET |
---|---|
see | Documentation |
array
Query args to send in to API call. See API docs for details.
array
List of available zones.import_zone_dns_records(string $id, string $file) : array
You can upload your BIND config through this endpoint. It assumes that cURL is called from a location with bind_config.txt (valid BIND config) present.
api | POST |
---|---|
see | Documentation |
see | BIND file format |
string
Zone ID.
string
BIND config to upload, i.e. "@bind_config.txt".
array
Request details.initiate_zone_activation_check(string $id) : array
leave_user_org(string $id) : array
Remove association to an organization.
api | DELETE |
---|---|
see | Documentation |
string
Organization id.
array
Array with removed org ID.purge_zone_cache_all(string $id) : array
Remove ALL files from Cloudflare's cache.
api | DELETE |
---|---|
see | Documentation |
string
Zone Id.
array
Purge results.purge_zone_cache_individual(string $id, array $files= null
, array $tags= null
) : array
Granularly remove one or more files from Cloudflare's cache either by specifying the URL or the associated Cache-Tag. All tiers can purge by URL. Cache-Tag is for Enterprise only.
Cache-Tag purging has a rate limit of up to 2,000 purge API calls in every 24 hour period. You may purge up to 30 tags in one API call.
api | DELETE |
---|---|
see | Documentation |
string
Zone Id.
array
An array of URLs that should be removed from cache.
array
Any assets served with a Cache-Tag header that matches one of the provided values will be purged from the Cloudflare cache.
array
Purge results.respond_user_invite(string $id, boolean $status) : array
api | PATCH |
---|---|
see | Documentation |
string
Invite id.
boolean
Invite status. Set to true to accept, and false to reject.
array
Array with invites details.response_code_msg(\[String] $code = ''
) : \[String]
\[String]
: Response code to get message from.
\[String]
: Message corresponding to response code sent in.test_zone_railguns()
update_user(string $first_name= null
, string $last_name= null
, string $phone= null
, string $country= null
, string $zipcode= null
) : array
Account Access: FREE, PRO, Business, Enterprise
api | PATCH |
---|---|
see | Documentation. |
access | public |
string
User's first name.
string
User's last name.
string
User's telephone number.
string
User's The country in which the user lives.
string
The zipcode or postal code where the user lives.
array
Updated user info.update_user_access_rule(string $id, string $mode, string $config_target, string $config_value, string $notes = ''
) : array
Update rule state and/or configuration. This will be applied across all zones owned by the user.
string
Access rule ID.
string
The action to apply to a matched request. Valid values: block, challenge, whitelist.
string
Rule configuration target. valid values: ip, ip_range, country.
string
Rule configuration value. See API docs for details.
string
A personal note about the rule. Typically used as a reminder or explanation for the rule.
array
Updated access rule info.update_user_subscriptions(string $subscription_id, integer $price, string $currency, string $frequency, array $optional_args = array()
) : array
api | PUT |
---|---|
see | Documentation |
string
Subscription identifier tag.
integer
The price of the subscription that will be billed, in US dollars.
string
The monetary unit in which pricing information is displayed.
string
How often the subscription is renewed automatically.
array
Array with optional parameters. See API docs for details.
array
Updated user subscription info.update_zone(string $id, boolean $paused= null
, array $vanity_name_servers= null
, array $plan= null
) : array
Only one zone property can be changed at a time.
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
Indicates if the zone is only using Cloudflare DNS services. A true value means the zone will not receive security or performance benefits. Valid values: true|false.
array
An array of domains used for custom name servers. This is only available for Business and Enterprise plans.
array
The desired plan for the zone. Changing this value will create/cancel associated subscriptions. To view available plans for this zone, see Zone Plans.
array
Updated zone info.update_zone_custom_page_details(string $id, string $page_id, string $url, string $state) : array
api | PUT |
---|---|
see | Documentation |
string
Zone ID.
string
Custom page ID.
string
A URL that is associated with the Custom Page.
string
The Custom Page state. Valid values: default, customized.
array
Custom page info.update_zone_dns_record(string $id, string $dns_id, string $type, string $name, string $content, integer $ttl= null
, boolean $proxied= null
) : array
api | PUT |
---|---|
see | Documentation |
string
Zone ID.
string
DNS record ID.
string
DNS record type, i.e "A".
string
DNS record name, i.e "example.com".
string
DNS record content, i.e "127.0.0.1".
integer
Time to live for DNS record. Value of 1 is 'automatic'.
boolean
Whether the record is receiving the performance and security benefits of Cloudflare.
array
The updated DNS recordupdate_zone_pagerule(string $id, string $pr_id, array $targets, array $actions, integer $priority= null
, string $status= null
) : array
api | PUT |
---|---|
see | Documentation |
string
Zone ID.
string
Page rule ID.
array
Targets to evaluate on a request. See API docs for details.
array
The set of actions to perform if the targets of this rule match the request. Actions can redirect the url to another url or override settings (but not both).
integer
A number that indicates the preference for a page rule over another. In the case where you may have a catch-all page rule (e.g., #1: '/images/') but want a rule that is more specific to take precedence (e.g., #2: '/images/special/'), you'll want to specify a higher priority on the latter (#2) so it will override the first. Default: 1.
string
Status of the page rule. Default: disabled. Valid Values: active, disabled.
array
Page rule info.update_zone_settings(string $id, array $items) : array
Edit settings for a zone.
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
array
One or more zone setting objects. Must contain an ID and a value.
array
Updated zone setting info.update_zone_settings_always_online(string $id, boolean $on) : array
When enabled, Always Online will serve pages from our cache if your server is offline (https://support.cloudflare.com/hc/en-us/articles/200168006).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_always_use_https(string $id, boolean $on) : array
Reply to all requests for URLs that use "http" with a 301 redirect to the equivalent "https" URL. If you only want to redirect for a subset of requests, consider creating an "Always use HTTPS" page rule.
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_automatic_https_rewrites(string $id, boolean $on) : array
Enable the Automatic HTTPS Rewrites feature for this zone.
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_browser_cache_ttl(string $id, integer $seconds) : array
Browser Cache TTL (in seconds) specifies how long Cloudflare-cached resources will remain on your visitors' computers. Cloudflare will honor any larger times specified by your server. (https://support.cloudflare.com/hc/en-us/articles/200168276).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
integer
Default value: 14400. Valid values: 30, 60, 300, 1200, 1800, 3600, 7200, 10800, 14400, 18000, 28800, 43200, 57600, 72000, 86400, 172800, 259200, 345600, 432000, 691200, 1382400, 2073600, 2678400, 5356800, 16070400, 31536000. Notes: The minimum TTL available depends on the plan level of the zone. (Enterprise = 30, Business = 1800, Pro = 1800, Free = 1800).
array
Updated zone setting info.update_zone_settings_browser_check(string $id, boolean $on) : array
Browser Integrity Check is similar to Bad Behavior and looks for common HTTP headers abused most commonly by spammers and denies access to your page. It will also challenge visitors that do not have a user agent or a non standard user agent (also commonly used by abuse bots, crawlers or visitors). (https://support.cloudflare.com/hc/en-us/articles/200170086).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_cache_level(string $id, string $level) : array
Cache Level functions based off the setting level. The basic setting will cache most static resources (i.e., css, images, and JavaScript). The simplified setting will ignore the query string when delivering a cached resource. The aggressive setting will cache all static resources, including ones with a query string. (https://support.cloudflare.com/hc/en-us/articles/200168256).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
string
Default value: aggressive. Valid values: aggressive, basic, simplified.
array
Updated zone setting info.update_zone_settings_challenge_ttl(string $id, integer $seconds) : array
Specify how long a visitor is allowed access to your site after successfully completing a challenge (such as a CAPTCHA). After the TTL has expired the visitor will have to complete a new challenge. We recommend a 15 - 45 minute setting and will attempt to honor any setting above 45 minutes. (https://support.cloudflare.com/hc/en-us/articles/200170136).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
integer
Default value: 1800. Valid values: 300, 900, 1800, 2700, 3600, 7200, 10800, 14400, 28800, 57600, 86400, 604800, 2592000, 31536000.
array
Updated zone setting info.update_zone_settings_development_mode(string $id, boolean $on) : array
Development Mode temporarily allows you to enter development mode for your websites if you need to make changes to your site. This will bypass Cloudflare's accelerated cache and slow down your site, but is useful if you are making changes to cacheable content (like images, css, or JavaScript) and would like to see those changes right away. Once entered, development mode will last for 3 hours and then automatically toggle off.
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_email_obfuscation(string $id, boolean $on) : array
Encrypt email adresses on your web page from bots, while keeping them visible to humans. (https://support.cloudflare.com/hc/en-us/articles/200170016).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_hotlink_protection(string $id, boolean $on) : array
When enabled, the Hotlink Protection option ensures that other sites cannot suck up your bandwidth by building pages that use images hosted on your site. Anytime a request for an image on your site hits Cloudflare, we check to ensure that it's not another site requesting them. People will still be able to download and view images from your page, but other sites won't be able to steal them for use on their own pages. (https://support.cloudflare.com/hc/en-us/articles/200170026).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_http2(string $id, boolean $on) : array
Value of the HTTP2 setting.
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_ip_geolocation(string $id, boolean $on) : array
Enable IP Geolocation to have Cloudflare geolocate visitors to your website and pass the country code to you. (https://support.cloudflare.com/hc/en-us/articles/200168236).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_ipv6(string $id, boolean $on) : array
Enable IPv6 on all subdomains that are Cloudflare enabled. (https://support.cloudflare.com/hc/en-us/articles/200168586).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_minify(string $id, boolean $css, boolean $html, boolean $js) : array
Automatically minify certain assets for your website (https://support.cloudflare.com/hc/en-us/articles/200168196).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
boolean
True to turn on, false to turn off.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_mirage(string $id, boolean $on) : array
Automatically optimize image loading for website visitors on mobile devices (http://blog.cloudflare.com/mirage2-solving-mobile-speed).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_mobile_redirect(string $id, boolean $status, string $mobile_subdomain, boolean $strip_uri) : array
Automatically redirect visitors on mobile devices to a mobile-optimized subdomain (https://support.cloudflare.com/hc/en-us/articles/200168336).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
string
True to turn on, false to turn off.
boolean
True tor false.
array
Updated zone setting info.update_zone_settings_opportunistic_encryption(string $id, boolean $on) : array
Enable the Opportunistic Encryption feature for this zone.
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_origin_error_page_pass_thru()
update_zone_settings_polish(string $id, boolean $on) : array
Strips metadata and compresses your images for faster page load times. Basic (Lossless): Reduce the size of PNG, JPEG, and GIF files - no impact on visual quality. Basic + JPEG (Lossy): Further reduce the size of JPEG files for faster image loading. Larger JPEGs are converted to progressive images, loading a lower-resolution image first and ending in a higher-resolution version. Not recommended for hi-res photography sites.
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_prefetch_preload()
update_zone_settings_pseudo_ipv4(string $id, boolean $on) : array
Value of the pseudo_ipv4 setting.
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_response_buffering()
update_zone_settings_rocket_loader(string $id, boolean $on) : array
Rocket Loader is a general-purpose asynchronous JavaScript loader coupled with a lightweight virtual browser which can safely run any JavaScript code after window.onload. Turning on Rocket Loader will immediately improve a web page's window.onload time (assuming there is JavaScript on the page), which can have a positive impact on your Google search ranking. Automatic Mode: Rocket Loader will automatically run on the JavaScript resources on your site, with no configuration required after turning on automatic mode. Manual Mode: In order to have Rocket Loader execute for a particular script, you must add the following attribute to the script tag: "data-cfasync='true'". As your page passes through Cloudflare, we'll enable Rocket Loader for that particular script. All other JavaScript will continue to execute without Cloudflare touching the script. (https://support.cloudflare.com/hc/en-us/articles/200168056).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_security_header(string $id, boolean $enabled, integer $max_age, boolean $include_subdomains, boolean $no_sniff) : array
Cloudflare security header for a zone.
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to enable HSTS.
integer
Max age in seconds.
boolean
True to include subdomains.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_security_level(string $id, boolean $level) : array
Choose the appropriate security profile for your website, which will automatically adjust each of the security settings. If you choose to customize an individual security setting, the profile will become Custom. (https://support.cloudflare.com/hc/en-us/articles/200170056).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
Default value: medium. Valid values: essentially_off, low, medium, high, under_attack.
array
Updated zone setting info.update_zone_settings_server_side_exclude(string $id, boolean $on) : array
If there is sensitive content on your website that you want visible to real visitors, but that you want to hide from suspicious visitors, all you have to do is wrap the content with Cloudflare SSE tags. Wrap any content that you want to be excluded from suspicious visitors in the following SSE tags: . For example: Bad visitors won't see my phone number, 555-555-5555 . Note: SSE only will work with HTML. If you have HTML minification enabled, you won't see the SSE tags in your HTML source when it's served through Cloudflare. SSE will still function in this case, as Cloudflare's HTML minification and SSE functionality occur on-the-fly as the resource moves through our network to the visitor's computer. (https://support.cloudflare.com/hc/en-us/articles/200170036).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_sort_query_string_for_cache()
update_zone_settings_ssl(string $id, boolean $on) : array
SSL encrypts your visitor's connection and safeguards credit card numbers and other personal data to and from your website. SSL can take up to 5 minutes to fully activate. Requires Cloudflare active on your root domain or www domain. Off: no SSL between the visitor and Cloudflare, and no SSL between Cloudflare and your web server (all HTTP traffic). Flexible: SSL between the visitor and Cloudflare -- visitor sees HTTPS on your site, but no SSL between Cloudflare and your web server. You don't need to have an SSL cert on your web server, but your vistors will still see the site as being HTTPS enabled. Full: SSL between the visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and your web server. You'll need to have your own SSL cert or self-signed cert at the very least. Full (Strict): SSL between the visitor and Cloudflare -- visitor sees HTTPS on your site, and SSL between Cloudflare and your web server. You'll need to have a valid SSL certificate installed on your web server. This certificate must be signed by a certificate authority, have an expiration date in the future, and respond for the request domain name (hostname). (https://support.cloudflare.com/hc/en-us/articles/200170416)
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_tls_1_2_only()
update_zone_settings_tls_1_3(string $id, boolean $on) : array
Enable Crypto TLS 1.3 feature for this zone.
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_tls_client_auth()
update_zone_settings_true_client_ip_header()
update_zone_settings_waf(string $id, boolean $on) : array
The WAF examines HTTP requests to your website. It inspects both GET and POST requests and applies rules to help filter out illegitimate traffic from legitimate website visitors. The Cloudflare WAF inspects website addresses or URLs to detect anything out of the ordinary. If the Cloudflare WAF determines suspicious user behavior, then the WAF will ‘challenge’ the web visitor with a page that asks them to submit a CAPTCHA successfully to continue their action. If the challenge is failed, the action will be stopped. What this means is that Cloudflare’s WAF will block any traffic identified as illegitimate before it reaches your origin web server. (https://support.cloudflare.com/hc/en-us/articles/200172016).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_webp(string $id, boolean $on) : array
When the client requesting the image supports the WebP image codec, Cloudflare will serve a WebP version of the image when WebP offers a performance advantage over the original image format.
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.update_zone_settings_websockets(string $id, boolean $on) : array
WebSockets are open connections sustained between the client and the origin server. Inside a WebSockets connection, the client and the origin can pass data back and forth without having to reestablish sessions. This makes exchanging data within a WebSockets connection fast. WebSockets are often used for real-time applications such as live chat and gaming. (https://support.cloudflare.com/hc/en-us/articles/200169466-Can-I-use-Cloudflare-with-WebSockets-).
api | PATCH |
---|---|
see | Documentation |
string
Zone ID.
boolean
True to turn on, false to turn off.
array
Updated zone setting info.build_request(string $route, array $args= array()
, array $method= 'GET'
) : \CloudFlareAPI
fluent | This method is part of a fluent interface and will return the same instance |
---|
string
API route to make the call to.
array
Arguments to pass into the API call.
array
HTTP Method to use for request.
\CloudFlareAPI
Returns an instance of itself so it can be chained to the fetch method.clear()
fetch() : array | \WP_Error
access | private |
---|
array
\WP_Error
Request results or WP_Error on request failure.is_status_ok(integer $code) : boolean
integer
HTTP status code.
boolean
True if status is within valid range.set_headers()
$base_uri : string
'https://api.cloudflare.com/client/v4/'
access | protected |
---|
$route : string
''
$api_key : string
$auth_email : string
$user_service_key : string