Jetpack reports a broken connection, the WordPress mobile app cannot log in, a shipping integration stops syncing orders, and the site editor throws publishing errors — while the site itself loads perfectly. That split is the signature of Cloudflare security settings sitting on /wp-json/. Every remote consumer of WordPress talks REST, and none of them can solve a browser challenge. The fix is identifying which Cloudflare feature is firing in Security > Events and writing the narrowest allow rule that lets your real integrations through.
What’s happening
The REST API is not an optional extra: Jetpack, the iOS/Android apps, WooCommerce integrations (POS, shipping, accounting), Zapier-style automation, headless frontends, and parts of the block editor all live on /wp-json/. Their requests come from servers and apps — no cookies, no JavaScript engine, often a plain HTTP library user agent. To several Cloudflare features, that profile reads as “bot”:
- Bot Fight Mode (Free) and Super Bot Fight Mode (Pro and up) score exactly this kind of traffic as automated. They are right — it is automated. It is also your revenue plumbing.
- WAF custom rules written broadly (“block requests with no referer”, country allowlists, user-agent filters) catch API clients that never send the fields a browser would.
- Managed Challenge / JS Challenge actions on paths that include
/wp-json/are unsolvable for a non-browser client; the integration sees a 403 and gives up. - Managed WAF rules occasionally trip on legitimate REST payloads — JSON bodies containing HTML from a page builder, for example.
One crucial distinction: a Cloudflare block returns an HTML interstitial with a cf-mitigated header. A WordPress-side restriction (a security plugin limiting REST to logged-in users) returns a JSON error like rest_login_required. JSON means the request reached PHP — stop tuning Cloudflare.
What to check first
- Security > Events, filter path begins with
/wp-json, group by service: bot fight mode, custom rules, managed rules, rate limiting. - Which client is failing — one integration (its IPs or ASN got caught) or all of them (a path-wide rule or bot feature)?
- Recent toggles: Super Bot Fight Mode enabled, “definitely automated” set to Block, Under Attack Mode left on after an incident.
- Whether the failures are total or intermittent — score-based features and rate limits produce intermittent failures; path rules are absolute.
How to verify
# The API index: expect HTTP 200 and a JSON body starting with {
curl -s -o /dev/null -D - https://www.example.com/wp-json/ \
| grep -iE '^HTTP/|cf-mitigated|content-type'
# A representative route an integration actually uses:
curl -sI 'https://www.example.com/wp-json/wp/v2/posts?per_page=1' \
| grep -iE '^HTTP/|cf-mitigated'
# Same call with a non-browser user agent, the way integrations look:
curl -sI -A 'ExampleSync/2.1 (+https://integrator.example)' \
'https://www.example.com/wp-json/wp/v2/posts?per_page=1' \
| grep -iE '^HTTP/|cf-mitigated'
If the plain request passes and the non-browser user agent draws cf-mitigated: challenge, a bot feature or user-agent rule is your culprit. Confirm the exact source in Security > Events — every blocked request lists the responsible service and rule ID.
The fix
- Read the event, not the tea leaves. Open a blocked
/wp-json/event and note the service. Everything below depends on it. - For your own custom rules, exclude authenticated API traffic rather than the whole path. A solid pattern: skip when the URI starts with
/wp-json/and the request carries anAuthorizationheader (application passwords, WooCommerce keys) or comes from the integration’s published IP ranges or ASN. Authentication still happens at WordPress; Cloudflare just stops pre-refusing it. - For managed rules, add an exception that skips the specific rule ID for the specific route that trips it — not the entire managed ruleset for all of
/wp-json/. - For Bot Fight Mode, respect its limits. On Free, BFM offers no per-request exceptions — you cannot skip it with a custom rule. If it is breaking a business integration, your honest options are turning it off and compensating with rate limiting plus targeted WAF rules, or moving to a plan where bot controls are configurable. On Pro, set Super Bot Fight Mode’s “definitely automated” action to Managed Challenge or Allow rather than Block only if you understand challenges still fail API clients — category-level tuning here is coarse, and per-request exceptions remain unreliable.
- Re-test each consumer: Jetpack’s connection test, a mobile app login, one live call per integration. Watch Events for residual matches over the next day.
When this fix is wrong
- The response is JSON (
rest_cannot_access,rest_login_required): a WordPress security plugin is restricting REST. Configure it there. - 401 errors with valid credentials: the origin is stripping the
Authorizationheader (common on CGI/FastCGI setups) — a server config fix, not a firewall fix. - Timeouts and 524s on heavy routes are origin performance, and no allow rule will speed up a 40-second query.
Common mistakes
- Blanket-skipping
/wp-json/*from all security — the REST API is also a favourite enumeration and brute-force surface (/wp-json/wp/v2/usersleaks usernames). - Testing from your own browser, which holds a challenge clearance cookie, and concluding the API “works” while server-side clients still die.
- Blocking XML-RPC and REST simultaneously and wondering why Jetpack — which uses both, depending on feature — will not connect.
- Writing an allow rule on a spoofable user-agent string alone. Combine it with IPs, ASN, or the presence of authentication.
- Leaving Under Attack Mode on for weeks; it challenges everything, APIs included.
Prevention
- Keep an inventory of REST consumers (integration, route, source IPs/ASN, auth method) so rules can be precise and audits fast.
- Add a synthetic check that calls a representative route with a non-browser user agent and alerts on anything but valid JSON.
- Review Security > Events for
/wp-jsonafter every security-setting change — the day you enable a bot feature is the day to look. - Structure custom rules deliberately: action choice and ordering are covered in Cloudflare WAF custom rules and actions, the WordPress-specific ruleset picture in WAF managed rulesets for WordPress, and the expression syntax in the Cloudflare WAF docs.
An API that fails only for machines is invisible in a browser check and fatal to the integrations a store runs on. Need Cloudflare stabilized in front of a WordPress or WooCommerce site that earns money? Stack Harbor runs that exact stack under enterprise WordPress support — book an infrastructure consult.