Bot protection
4 operations in the WP Waterfall API.
- getBot protection settings
- putChange the bot protection level
- getRequest breakdown for the last 24 hours
- getBot traffic in the last 24 hours
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
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string (uuid) | The id of the environment. |
Responses
| Status | Body | Description |
|---|---|---|
200 | BotProtection | Settings |
400 | Problem | The request could not be read: bad JSON, a bad header, or a malformed value. |
401 | Problem | The credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme. |
403 | Problem | The credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing. |
404 | Problem | The thing in the path does not exist, or it belongs to another company. The answer is the same for both. |
422 | Problem | The request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field. |
429 | Problem | A rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address. |
4XX | Problem | Problem Details (RFC 9457) |
200 response fields
| Name | Type | Description |
|---|---|---|
mode required | string | Legacy: off, challenge, or block, derived from enabled and level. One of: off, monitor, challenge, block. |
enabled required | boolean | False when the owner turned bot protection off. The always-on baseline still runs. |
level required | string | One of: block_malicious, block_automations, challenge_bots, challenge_non_browsers, challenge_everyone. |
matrix_key required | string | Which version of BOT_LEVELS the levels follow. |
allow_verified required | boolean | Verified crawlers (search engines, uptime monitors) always pass. |
exclusions required | array of string | Paths that skip bot checks, such as webhooks. |
allowlist required | array of string | IPs and ranges that skip bot checks. |
block_ai_crawlers required | boolean | Refuse AI training and AI search crawlers at the edge (no Cloudflare rule). |
user_agent_allowlist required | array of string | User agent fragments that skip bot checks and the AI crawler block, such as a monitor. |
rule_expression required | string or null | The Cloudflare rule expression WP Waterfall writes for this mode. |
applied required | boolean | |
updated_at required | string (date-time) | |
fixed | boolean | True 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. |
enforcement | object | |
enforcement.state required | string | One of: edge, server, edge_and_server, pending, failed, off. |
enforcement.notes required | array of string | |
enforcement.job_id required | string or null (uuid) | The last apply job, or null when nothing was applied yet. |
enforcement.updated_at required | string or null (date-time) | |
stats | BotStats | |
stats.window required | string | |
stats.available required | boolean | True 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 required | integer | Range: 0 to any. |
stats.challenged required | integer | Range: 0 to any. |
stats.blocked required | integer | Range: 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
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string (uuid) | The id of the environment. |
Idempotency-Key | header | string | Optional 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
| Name | Type | Description |
|---|---|---|
level | string | One of: block_malicious, block_automations, challenge_bots, challenge_non_browsers, challenge_everyone. |
enabled | boolean | |
mode | string | One of: off, monitor, challenge, block. |
allow_verified | boolean | |
exclusions | array of string | |
allowlist | array of string | |
block_ai_crawlers | boolean | |
user_agent_allowlist | array of string |
Responses
| Status | Body | Description |
|---|---|---|
202 | Job | Accepted. The body is the Job object. Follow GET /jobs/{id}/events or poll GET /jobs/{id}. |
400 | Problem | The request could not be read: bad JSON, a bad header, or a malformed value. |
401 | Problem | The credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme. |
403 | Problem | The credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing. |
404 | Problem | The thing in the path does not exist, or it belongs to another company. The answer is the same for both. |
409 | Problem | The current state does not allow this: the same change is already running, or another change got there first. |
422 | Problem | The request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field. |
429 | Problem | A rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address. |
4XX | Problem | Problem Details (RFC 9457) |
202 response fields
| Name | Type | Description |
|---|---|---|
id required | string (uuid) | UUIDv7 |
type required | string | A 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 required | string | One of: queued, dispatched, running, succeeded, failed, cancelled. |
environment_id required | string or null (uuid) | UUIDv7 |
site_id required | string or null (uuid) | UUIDv7 |
node_id required | string or null (uuid) | UUIDv7 |
group_id required | string or null (uuid) | UUIDv7 |
progress required | integer | Range: 0 to 100. |
attempts required | integer | Range: 0 to any. |
error required | object or null | |
error.code required | string | |
error.message required | string | |
error.retryable required | boolean | Default: false. |
result required | object or null | |
description | string or null | What 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_name | string or null | The name of the site the job belongs to, when it has one. |
environment_name | string or null | The name of the environment the job runs on, such as live or staging. |
quiet | boolean | True 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_id | string 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 required | object | |
requested_by.type required | string | One of: user, api_key, mcp_agent, system. |
requested_by.id required | string or null | |
requested_by.label required | string or null | |
requested_by.client_name | string or null | MCP 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
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string (uuid) | The id of the environment. |
Responses
| Status | Body | Description |
|---|---|---|
200 | BotBreakdown | Breakdown |
400 | Problem | The request could not be read: bad JSON, a bad header, or a malformed value. |
401 | Problem | The credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme. |
403 | Problem | The credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing. |
404 | Problem | The thing in the path does not exist, or it belongs to another company. The answer is the same for both. |
422 | Problem | The request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field. |
429 | Problem | A rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address. |
4XX | Problem | Problem Details (RFC 9457) |
200 response fields
| Name | Type | Description |
|---|---|---|
window required | string | |
available required | boolean | |
total required | integer | Every request Cloudflare saw for the environment's hostnames. Range: 0 to any. |
classes required | array of object | Requests by the user agent name Cloudflare reports. The three add up to total. |
classes[].id required | string | One of: browsers, named_bots, unclassified. |
classes[].label required | string | |
classes[].count required | integer or null | Range: 0 to any. |
classes[].percent required | number or null | Range: 0 to 100. |
outcomes required | array of object | Requests by what Cloudflare answered. The three add up to total when all are counted. |
outcomes[].id required | string | One of: allowed, challenged, blocked. |
outcomes[].label required | string | |
outcomes[].count required | integer or null | Range: 0 to any. |
outcomes[].percent required | number or null | Range: 0 to 100. |
note required | string | Plain 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
| Name | In | Type | Description |
|---|---|---|---|
id required | path | string (uuid) | The id of the environment. |
Responses
| Status | Body | Description |
|---|---|---|
200 | BotStats | Stats |
400 | Problem | The request could not be read: bad JSON, a bad header, or a malformed value. |
401 | Problem | The credentials are missing, expired, or revoked. The WWW-Authenticate header names the Bearer scheme. |
403 | Problem | The credentials are valid but may not do this: the role, the API key scope, or a required confirmation is missing. |
404 | Problem | The thing in the path does not exist, or it belongs to another company. The answer is the same for both. |
422 | Problem | The request was read but a value is not valid, or a required confirmation or Idempotency-Key is missing. The errors list names each field. |
429 | Problem | A rate limit was reached. Wait Retry-After seconds. Limits are per caller, per company, and per address. |
4XX | Problem | Problem Details (RFC 9457) |
200 response fields
| Name | Type | Description |
|---|---|---|
window required | string | |
available required | boolean | True 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 required | integer | Range: 0 to any. |
challenged required | integer | Range: 0 to any. |
blocked required | integer | Range: 0 to any. |
verified_allowed required | integer or null | Null when the zone has no Cloudflare Bot Management, which verified bot counts need. Range: 0 to any. |
note required | string |