For AI agents: a documentation index is available at /llms.txt
Skip to main content

Solving Cloudflare Challenges

Bypass Cloudflare Turnstile and JS challenges to access protected pages — using the Browserless /unblock endpoint or BQL's solve(type: cloudflare) mutation.

Prerequisites

Steps

Use the /unblock REST endpoint to bypass Cloudflare challenges and retrieve page content. No WebSocket connection needed.

View Full Code on GitHub

1. Build the request

Use the /unblock endpoint with proxy=residential — Cloudflare's bot detection is significantly harder to bypass from datacenter IPs, so residential proxies have a much higher success rate:

https://production-sfo.browserless.io/unblock?token=YOUR_API_TOKEN_HERE&proxy=residential

2. Send the request

curl -X POST \
"https://production-sfo.browserless.io/unblock?token=YOUR_API_TOKEN_HERE&proxy=residential" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example-cloudflare-protected.com",
"content": true,
"cookies": false,
"screenshot": false,
"browserWSEndpoint": false
}'

3. Check the output

The response contains the fully unblocked page HTML:

{
"content": "<!DOCTYPE html><html>...</html>",
"cookies": [],
"screenshot": null,
"browserWSEndpoint": null
}

Set "screenshot": true or "cookies": true to include those in the response as well.

Next steps