Skip to content

Bot protection

4 operations in the WP Waterfall API.

Bot protection settings

get/environments/{id}/bot-protectionPermalink to Bot protection settings

  • Scope: sites:read
  • Permission: sites.read

The switch, the level (one of BOT_LEVELS, versioned by matrix_key), verified bots, exceptions, where the rule runs, and the request counts for the last 24 hours.

Parameters

NameInTypeDescription
id requiredpathstring (uuid)The id of the environment.

Responses

StatusBodyDescription
200BotProtectionSettings
400ProblemThe request could not be read: bad JSON, a bad header, or a malformed value.
401ProblemThe credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme.
403ProblemThe credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing.
404ProblemThe thing in the path does not exist, or it belongs to another company. The answer is the same for both.
422ProblemThe request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field.
429ProblemA rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address.
4XXProblemProblem Details (RFC 9457)

200 response fields

NameTypeDescription
mode requiredstringLegacy: off, challenge, or block, derived from enabled and level. One of: off, monitor, challenge, block.
enabled requiredbooleanFalse when the owner turned bot protection off. The always-on baseline still runs.
level requiredstringOne of: block_malicious, block_automations, challenge_bots, challenge_non_browsers, challenge_everyone.
matrix_key requiredstringWhich version of BOT_LEVELS the levels follow.
allow_verified requiredbooleanVerified crawlers (search engines, uptime monitors) always pass.
exclusions requiredarray of stringPaths that skip bot checks, such as webhooks.
allowlist requiredarray of stringIPs and ranges that skip bot checks.
block_ai_crawlers requiredbooleanRefuse AI training and AI search crawlers at the edge (no Cloudflare rule).
user_agent_allowlist requiredarray of stringUser agent fragments that skip bot checks and the AI crawler block, such as a monitor.
rule_expression requiredstring or nullThe Cloudflare rule expression WP Waterfall writes for this mode.
applied requiredboolean
updated_at requiredstring (date-time)
fixedbooleanTrue on staging, preview, and preview environments. They always refuse crawlers and bots at the edge and on the server; the setting cannot be changed there, and live's setting does not apply to them.
enforcementobject
enforcement.state requiredstringOne of: edge, server, edge_and_server, pending, failed, off.
enforcement.notes requiredarray of string
enforcement.job_id requiredstring or null (uuid)The last apply job, or null when nothing was applied yet.
enforcement.updated_at requiredstring or null (date-time)
statsBotStats
stats.window requiredstring
stats.available requiredbooleanTrue when Cloudflare reports security events for this environment's hostnames. False when the token lacks analytics access or the zone's plan cannot filter by hostname; the counts are zero then and note says why.
stats.requests requiredintegerRange: 0 to any.
stats.challenged requiredintegerRange: 0 to any.
stats.blocked requiredintegerRange: 0 to any.

Change the bot protection level

put/environments/{id}/bot-protectionPermalink to Change the bot protection level

  • Scope: sites:write
  • Permission: edge.manage

Sets the level (block_malicious, block_automations, challenge_bots, challenge_non_browsers, or challenge_everyone), turns protection on or off, or changes verified bots, exceptions (paths, addresses, and user agent fragments), and Block AI crawlers. Block AI crawlers is a flag the edge cache Worker reads, so it costs no Cloudflare rule; search engines are not blocked. Fields left out keep their value. The legacy mode field still works. The apply_bot_protection job adds the site's hostnames to the level's shared Cloudflare rule. Staging, preview, and preview environments always refuse crawlers and bots and answer 409: their protection is fixed.

Parameters

NameInTypeDescription
id requiredpathstring (uuid)The id of the environment.
Idempotency-KeyheaderstringOptional on PUT and PATCH. When the call starts a job, a retry with the same key, path, and body within 24 hours returns that job instead of starting another. A different path or body starts a new job.

Request body application/json, required, PutBotProtectionRequest

Fields

NameTypeDescription
levelstringOne of: block_malicious, block_automations, challenge_bots, challenge_non_browsers, challenge_everyone.
enabledboolean
modestringOne of: off, monitor, challenge, block.
allow_verifiedboolean
exclusionsarray of string
allowlistarray of string
block_ai_crawlersboolean
user_agent_allowlistarray of string

Responses

StatusBodyDescription
202JobAccepted. The body is the Job object. Follow GET /jobs/{id}/events or poll GET /jobs/{id}.
400ProblemThe request could not be read: bad JSON, a bad header, or a malformed value.
401ProblemThe credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme.
403ProblemThe credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing.
404ProblemThe thing in the path does not exist, or it belongs to another company. The answer is the same for both.
409ProblemThe current state does not allow this: the same change is already running, or another change got there first.
422ProblemThe request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field.
429ProblemA rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address.
4XXProblemProblem Details (RFC 9457)

202 response fields

NameTypeDescription
id requiredstring (uuid)UUIDv7
type requiredstringA node job type or an edge job type. One of: provision_environment, delete_environment, set_php_version, set_php_performance, set_php_settings, restart_php, clear_server_cache, search_replace, run_wp_cli, rotate_credentials, apply_nginx_settings, db_import, cron_sync, build_release, activate_release, create_repository, create_node, drain_node, delete_node, purchase_cud, files_write, files_delete, files_rename, phpmyadmin_session, db_check, db_rows_write, db_sql_execute, ssh_update, sftp_account_change, tool_setting, wp_user_create, set_code_mode, env_var_set, env_var_delete, reset_site, set_webroot, set_wp_secrets_key, wp_admin_login_token, wp_login_user_ensure, wp_login_users_remove, repo_commit_read, create_preview_environment, clone_content, merge_branch, create_snapshot, restore_snapshot, set_apm, push_content, commit_branch, sync_working_tree, issue_certificate, register_hostname, unregister_hostname, object_cache_set, patchstack_credentials_write, patchstack_credentials_remove, patchstack_kill_switch, set_disk_quota, prepare_standby, start_replication, verify_replica, fence_site, resync_replica, set_site_suspension, clear_log, promote_environment, copy_into_live, auto_update_run, delete_snapshot, prune_snapshots, backup_download, configure_git_remote, import_git_push, pull_external_git, offsite_backup_test, offsite_backup_run, offsite_backup_list, offsite_backup_restore, restart_service, container_exec, set_network_domain, map_subsite_domain, reap_orphan_containers, migrate_container, migrate_control, migrate_export, migrate_import, migrate_precopy, migrate_delta, migrate_freeze, migrate_thaw, update_mu_plugin, import_site_files, wake_environment, set_sleep_policy, integrity_check, malware_scan, malware_restore, container_images, rebuild_container, update_runtime_image, node_reboot_status, schedule_node_reboot, reboot_node, core_update_commit, core_update_advance, core_update_run, takedown_environment, release_takedown, set_egress, set_standby_hold, copy_evidence, drop_evidence, transfer_site, relabel_environment, record_site_facts, attach_domain, remove_domain, set_primary_domain, apply_redirects, apply_ip_rules, apply_bot_protection, purge_cache, apply_edge_settings, provision_dns_zone, refresh_ssl, set_edge_certificate, remove_edge_certificate, rename_site, rename_temp_hostname, network_sync, migration_fetch, migration_inspect, migration_triage, migration_import, migration_move, export_company_data, export_user_data, export_audit_log, purge_company, reseal_secrets, run_pagespeed, patchstack_provision, patchstack_deprovision, patchstack_reconcile, wp_login_member_users_remove, provision_standby, failover_site, failback_site, accessibility_scan.
status requiredstringOne of: queued, dispatched, running, succeeded, failed, cancelled.
environment_id requiredstring or null (uuid)UUIDv7
site_id requiredstring or null (uuid)UUIDv7
node_id requiredstring or null (uuid)UUIDv7
group_id requiredstring or null (uuid)UUIDv7
progress requiredintegerRange: 0 to 100.
attempts requiredintegerRange: 0 to any.
error requiredobject or null
error.code requiredstring
error.message requiredstring
error.retryable requiredbooleanDefault: false.
result requiredobject or null
descriptionstring or nullWhat the job does, in one plain sentence, such as "Turn on the server cron on site Elric (staging)". It names the action and the place and never holds a secret, a value, or site content: a WP-CLI command shows its command words and the names that are safe to show, and a placeholder such as "(value hidden)" for the rest. Null on old servers.
site_namestring or nullThe name of the site the job belongs to, when it has one.
environment_namestring or nullThe name of the environment the job runs on, such as live or staging.
quietbooleanTrue for background work and reads, such as a cron sync or a login link lookup. A customer screen leaves a quiet job out of its bell, its lists, and its toasts. Quiet jobs are still stored, audited, and retried. Absent on old servers, where nothing is quiet.
parent_job_idstring or null (uuid)The job this one works for: the job that ran it as a step, or that queued it as a follow-up. That job reads as done only once its follow-ups ended: it stays running until then, and its log names any follow-up that failed. Null for a job nobody started on another's behalf. Absent on old servers.
requested_by requiredobject
requested_by.type requiredstringOne of: user, api_key, mcp_agent, system.
requested_by.id requiredstring or null
requested_by.label requiredstring or null
requested_by.client_namestring or nullMCP client name and version from the handshake, for mcp_agent requests.

Request breakdown for the last 24 hours

get/environments/{id}/bot-protection/breakdownPermalink to Request breakdown for the last 24 hours

  • Scope: sites:read
  • Permission: sites.read

Requests by Cloudflare's user agent name (browsers, named bots and tools, unclassified) and by answer (allowed, challenged, blocked). Only what Cloudflare Free can count is returned: challenged is null when the zone's plan does not report security events, and blocked counts 403 and 429 answers. There is no bot score, so people and bots that look like browsers share one class.

Parameters

NameInTypeDescription
id requiredpathstring (uuid)The id of the environment.

Responses

StatusBodyDescription
200BotBreakdownBreakdown
400ProblemThe request could not be read: bad JSON, a bad header, or a malformed value.
401ProblemThe credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme.
403ProblemThe credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing.
404ProblemThe thing in the path does not exist, or it belongs to another company. The answer is the same for both.
422ProblemThe request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field.
429ProblemA rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address.
4XXProblemProblem Details (RFC 9457)

200 response fields

NameTypeDescription
window requiredstring
available requiredboolean
total requiredintegerEvery request Cloudflare saw for the environment's hostnames. Range: 0 to any.
classes requiredarray of objectRequests by the user agent name Cloudflare reports. The three add up to total.
classes[].id requiredstringOne of: browsers, named_bots, unclassified.
classes[].label requiredstring
classes[].count requiredinteger or nullRange: 0 to any.
classes[].percent requirednumber or nullRange: 0 to 100.
outcomes requiredarray of objectRequests by what Cloudflare answered. The three add up to total when all are counted.
outcomes[].id requiredstringOne of: allowed, challenged, blocked.
outcomes[].label requiredstring
outcomes[].count requiredinteger or nullRange: 0 to any.
outcomes[].percent requirednumber or nullRange: 0 to 100.
note requiredstringPlain words on what is measured and what is not.

Bot traffic in the last 24 hours

get/environments/{id}/bot-protection/statsPermalink to Bot traffic in the last 24 hours

  • Scope: sites:read
  • Permission: sites.read

Returns counts for the environment's hostnames over the last 24 hours: requests, challenged, blocked, and verified_allowed, which is null when the zone has no Cloudflare Bot Management. available is false when Cloudflare does not report these events for the hostnames: the counts are zero then, and note says why.

Parameters

NameInTypeDescription
id requiredpathstring (uuid)The id of the environment.

Responses

StatusBodyDescription
200BotStatsStats
400ProblemThe request could not be read: bad JSON, a bad header, or a malformed value.
401ProblemThe credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme.
403ProblemThe credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing.
404ProblemThe thing in the path does not exist, or it belongs to another company. The answer is the same for both.
422ProblemThe request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field.
429ProblemA rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address.
4XXProblemProblem Details (RFC 9457)

200 response fields

NameTypeDescription
window requiredstring
available requiredbooleanTrue when Cloudflare reports security events for this environment's hostnames. False when the token lacks analytics access or the zone's plan cannot filter by hostname; the counts are zero then and note says why.
requests requiredintegerRange: 0 to any.
challenged requiredintegerRange: 0 to any.
blocked requiredintegerRange: 0 to any.
verified_allowed requiredinteger or nullNull when the zone has no Cloudflare Bot Management, which verified bot counts need. Range: 0 to any.
note requiredstring