When ScrapingBee answers a Cloudflare-protected URL with a 500, or with a 200 whose body is the "Just a moment..." interstitial, the configuration you sent was not strong enough for that site, or the page came back before the real content loaded. Escalate in ScrapingBee's documented order: premium_proxy=true, then stealth_proxy=true, or let mode=auto pick the cheapest configuration that works; add wait_for for a selector of the real page and leave transparent_status_code off unless you need it. If Cloudflare's challenge is your only obstacle and you fetch many pages per site, a dedicated solver that returns a cf_clearance cookie for your own HTTP client can cost less.
Status codes, parameters and credit costs below come from ScrapingBee's documentation and pricing page (checked 2026-12-01). ScrapingBee is a full scraping API with rendering, screenshots, JavaScript scenarios and extraction; this guide only covers what to do when Cloudflare is in the way.
Quick answer: ScrapingBee responses on Cloudflare sites
ScrapingBee documents which status codes are billed. By default it turns any 2xx into 200, passes 404, 410 and 413 through, and turns everything else into 500.
- 500 (not billed)
- The page could not be scraped, or the target returned a status ScrapingBee does not pass through, such as Cloudflare's 403. A failed scrape is already retried on another proxy. Read the body for the reason, then escalate: premium_proxy=true, then stealth_proxy=true, or use mode=auto.
- 200, but the body is the "Just a moment..." page
- The HTML was captured before the challenge cleared or the real page loaded. Add wait_for with a CSS or XPath selector that exists only on the real page (or wait, up to 35,000 ms), and use premium or stealth proxies.
- 403 from ScrapingBee
- Not the target's 403: ScrapingBee says this code is never the scraped page's own 403. Your account is banned or the request was redirected to a blocked destination. Not billed. The response body says which case applies.
- 401
- Out of credits or invalid API key. Not billed. Check the key (send it as Authorization: Bearer) or upgrade the plan.
- 429
- Too many concurrent requests for your plan. Not billed. Wait for the Retry-After header or send fewer requests in parallel.
- 400
- Bad request. Not billed. Fix the parameters; the body names the problem. With mode=auto, do not also pass render_js, premium_proxy, stealth_proxy or transparent_status_code.
- 403 returned and billed with transparent_status_code=true
- With this option, anything the target returns below 500 is billed and there are no retries. Turn transparent_status_code off while you tune the configuration; read Spb-initial-status-code instead.
- stealth_proxy ignores my headers or cookies
- Custom headers and cookies are not supported with stealth_proxy, and it only works with JavaScript rendering enabled. Drop the custom headers and cookies, keep render_js at its default (on).
Why Cloudflare still blocks requests sent through ScrapingBee
ScrapingBee retries failed scrapes for you, so a 500 that reaches your code usually means the configuration, not a single bad proxy, is the problem. The common causes:
- Standard proxies on a site that challenges them. Premium proxies exist, in ScrapingBee's words, "to bypass difficult to scrape websites", and the stealth pool was built "for hard websites to scrape".
- render_js=false. Turning rendering off saves credits but means no browser executes Cloudflare's challenge script.
- Returning too early. Without wait_for, wait or wait_browser, the HTML can be captured while the interstitial is still on screen.
- Options that fight the stealth pool: custom headers and cookies are not supported with stealth_proxy.
- Hidden status codes. Because non-passed statuses become 500, you may not see that Cloudflare answered 403 unless you read Spb-initial-status-code or the error body.
Fix 1: let Auto-Mode choose (mode=auto)
ScrapingBee's Auto-Mode "picks the cheapest configuration that successfully scrapes your page", costing 1, 5, 10, 25 or 75 credits depending on the configuration that worked. If every configuration fails, the request costs 0 credits. The Spb-auto-cost header reports what Auto-Mode charged.
Do not combine it with render_js, premium_proxy, stealth_proxy or transparent_status_code: Auto-Mode sets those itself. For a site you scrape every day, run a few URLs with mode=auto, note the cost in Spb-auto-cost, then pin that configuration explicitly if you want predictable spending.
import requests
SB = "https://app.scrapingbee.com/api/v1"
HEADERS = {"Authorization": "Bearer YOUR_SCRAPINGBEE_KEY"}
URL = "https://example.com/products"
def fetch(**opts):
# the API's own timeout parameter defaults to 140,000 ms: wait at least that long
r = requests.get(SB, headers=HEADERS, params={"url": URL, **opts}, timeout=150)
print(r.status_code, "cost:", r.headers.get("Spb-cost"),
"target status:", r.headers.get("Spb-initial-status-code"))
return r
def blocked(r):
return r.status_code == 500 or "Just a moment" in r.text
# 1) Auto-Mode: cheapest configuration that works, 0 credits if every one fails
r = fetch(mode="auto")
# 2) Or escalate by hand: premium proxy + JS rendering (25 credits)...
if blocked(r):
r = fetch(premium_proxy="true", country_code="us", wait_for=".product-list")
# 3) ...then the stealth pool (75 credits, JS rendering on, no custom headers/cookies)
if blocked(r):
r = fetch(stealth_proxy="true")
if r.status_code == 500:
print(r.text[:500]) # the body carries the reason; 500s are not billedFix 2: escalate proxies by hand
If you configure requests yourself, escalate in this order and stop at the first level that returns the real page:
- render_js (default on): "Render the JavaScript on the page with a headless browser", 5 credits per request.
- premium_proxy=true: 25 credits with JavaScript rendering, 10 without. Add country_code (premium proxy geolocation) if the site behaves differently by country.
- stealth_proxy=true: "Each successful API call using this option will cost 75 credits". It only works with JavaScript rendering enabled and does not support custom headers and cookies.
- session_id routes several requests through the same IP, which helps when a site issues cookies on a first page and checks them on the next.
Fix 3: wait for the real page, not the interstitial
wait adds time in milliseconds (0 to 35,000) for JavaScript to render. wait_for makes the headless browser wait for a CSS or XPath selector before returning the HTML, which is the most reliable option: pick an element that only exists on the real page, such as a product grid or article body. wait_browser waits for network conditions instead.
ScrapingBee blocks images and CSS by default to speed up requests (block_resources) and does not block ads unless you set block_ads. If a challenge never completes with resources blocked, test once with block_resources=false. Keep the API timeout parameter at its default (140,000 ms); ScrapingBee warns that changing it could hurt your success rate, and your own HTTP client should wait at least that long.
Fix 4: read the status codes and Spb- headers correctly
ScrapingBee's status handling is designed so you only pay for useful responses. Use it rather than fighting it:
- Billed: 200, 404, 410 and 413. Not billed: 400, 401, 403, 429 and 500.
- transparent_status_code=true returns the target's own code, but then every response below 500 is billed (a Cloudflare 403 included) and there are no retries. Leave it off while tuning.
- Spb-cost gives the request's credit cost, Spb-initial-status-code the status the scraped page first returned, Spb-resolved-url the final URL, and Spb-request-id an ID to quote to support. Headers and cookies from the target are returned prefixed with Spb-.
What a Cloudflare-protected page costs on ScrapingBee
Prices checked 2026-12-01 on scrapingbee.com/pricing (excluding VAT): Hobby $19 per month for 75,000 credits, Freelance $49 for 250,000, Startup $99 for 1,000,000 and Business $249 for 3,000,000. Credits are valid for one month and do not roll over; the trial gives 1,000 free credits with no card.
By our arithmetic on the Startup plan, a premium proxy request with rendering (25 credits) works out at about $2.48 per 1,000 pages and a stealth proxy request (75 credits) at about $7.43 per 1,000. Failed 500s cost nothing, and each successful response includes the proxy and the browser.
When a dedicated challenge solver is cheaper or simpler
A cf_clearance solver changes what you pay for. You solve the Cloudflare challenge once, receive the clearance cookie and the matching User-Agent, and send the following requests with your own HTTP client through your own proxy. Cloudflare documents a default clearance lifetime of 30 minutes, during which no new challenge is shown, so the cost of one solve is spread over every request in that window.
This fits when the challenge is the only obstacle, the data is in the HTML or a JSON endpoint, and you request many pages from the same few sites, especially if a stealth-level configuration would otherwise be needed for each page. NSLSolver charges $1.00 per 1,000 successful Cloudflare Challenge solves; you pay your own proxy traffic.
ScrapingBee remains the simpler tool when you need rendered content, screenshots, JavaScript scenarios, many unrelated domains or no proxy management at all. NSLSolver covers Cloudflare Turnstile, Cloudflare Challenge, reCAPTCHA v3 / Enterprise, Kasada and Akamai (beta), and does not solve reCAPTCHA v2, hCaptcha, image or text CAPTCHAs, FunCaptcha, GeeTest or DataDome.
The same Cloudflare challenge with NSLSolver
Send the url, the challenge site_key (the 0x... widget id from the challenge page) and your proxy to POST /solve. The response contains cookies, including cf_clearance, and the user_agent to replay through the same proxy. Leave user_agent out of the request, or send an iPhone Safari UA, because the clearance is issued for an iPhone Safari User-Agent. Challenge solves average about 3.3 seconds and there is no polling.
Only automate sites you own or are authorised to access. Sign up with Google, Gmail or Proton for $0.10 of free credit (about 125 Turnstile solves), no card required.
import requests
API = "https://api.nslsolver.com/solve"
PROXY = "http://user:pass@host:port" # your proxy: used for the solve AND the replay
TARGET = "https://example.com/products"
# 1) One solve: NSLSolver passes the Cloudflare challenge and returns cf_clearance
r = requests.post(API, headers={"X-API-Key": "YOUR_API_KEY"}, json={
"type": "challenge",
"url": TARGET,
"site_key": "0x4AAAAAAAxxxxxxxxxxxxxxxx", # challenge widget id (0x...) from the page
"proxy": PROXY,
# no user_agent: the clearance is issued for the solver's iPhone Safari
}, timeout=120)
r.raise_for_status() # 400 field, 401 key, 402 balance, 429 rate, 503 retry (not billed)
data = r.json()
# 2) Replay with your own HTTP client: same proxy, returned cookies and user_agent
s = requests.Session()
s.proxies = {"http": PROXY, "https": PROXY}
s.cookies.update(data["cookies"]) # includes cf_clearance
s.headers["User-Agent"] = data["user_agent"]
for page in range(1, 51):
resp = s.get(f"{TARGET}?page={page}", timeout=30)
if resp.status_code == 403 and "Just a moment" in resp.text:
break # clearance expired or the context changed: solve again
print(page, resp.status_code, len(resp.text))