Skip to content
Guide

ScraperAPI Not Working on Cloudflare in 2026: Status Codes, Parameters and Fixes

NSLSolver TeamPublished Updated 8 min read

When ScraperAPI returns a 500 for a Cloudflare-protected URL, it has already retried for up to 70 seconds without getting a usable page, and you are not charged. ScraperAPI's own advice for protected domains is premium=true or ultra_premium=true, usually with render=true; a 200 that still contains a CAPTCHA should be reported to their support so it is added to their detection. Also check your client: a timeout shorter than 70 seconds cuts off the retries and is billed. If Cloudflare's challenge is the only obstacle and you request many pages per site, a dedicated solver that returns a cf_clearance cookie for your own HTTP client can be cheaper.

Status codes, parameters and credit costs below come from ScraperAPI's documentation and pricing page (checked 2026-12-01). ScraperAPI also offers structured data endpoints, async jobs and more; this guide is only about Cloudflare.

Quick answer: ScraperAPI responses on Cloudflare sites

ScraperAPI charges only for 200 and 404 responses. Here is what the other codes mean and what its documentation says to do.

500 (not charged)
The request failed after ScraperAPI retried it for up to 70 seconds. Verify the URL. For protected domains ScraperAPI points to premium=true or ultra_premium=true; add render=true if the challenge needs JavaScript.
200, but the HTML is a Cloudflare challenge or CAPTCHA
The page returned was not the real content. ScraperAPI asks you to contact support so the page is added to its detection database. Meanwhile, use render=true with wait_for_selector on an element of the real page.
403 from ScraperAPI
Not a Cloudflare block: ScraperAPI uses 403 for "You have exhausted the API Credits available in this monthly cycle." Upgrade, enable overages or contact support.
429
Too many simultaneous requests for your plan. Lower concurrency to your plan's thread limit.
401
Unauthorized: the API key is not valid. Copy the key again from the dashboard.
400
Malformed request. Check the target URL (URL-encode it) and the parameter spelling.
ultra_premium ignores my headers
With ultra_premium=true, ScraperAPI discards all custom headers, even with keep_headers=true. Drop the custom headers for those requests, or use premium=true with keep_headers=true.
premium and ultra_premium together / session_number with premium
premium and ultra_premium are mutually exclusive, and session_number cannot be combined with either. Send one proxy tier per request; drop session_number on premium tiers.
Requests billed although nothing came back
Requests you cancel before ScraperAPI's 70-second window are charged. Set your client timeout to at least 70 seconds.

Why Cloudflare still blocks requests through ScraperAPI

A plain ScraperAPI request uses standard proxies and no browser. On Cloudflare sites that is often not enough, and the failure mode depends on what is missing:

  • No premium tier. ScraperAPI's status page says protected domains may need premium=true (residential and mobile IPs) or ultra_premium=true ("our advanced bypass mechanisms").
  • No rendering. Without render=true no browser runs Cloudflare's challenge script, and wait_for_selector only works together with render=true.
  • A client that gives up early. ScraperAPI retries for up to 70 seconds before answering. A shorter timeout cancels the request, and the docs say requests cancelled before that window are billed.
  • Conflicting parameters: premium with ultra_premium, session_number with a premium tier, or custom headers with ultra_premium.
  • Misreading the status code. ScraperAPI's 403 means your credits are exhausted, not that Cloudflare blocked you.

Fix 1: estimate the cost, then escalate step by step

ScraperAPI publishes the cost of each option: render=true 10 credits, premium=true 10 (25 with render), ultra_premium=true 30 (75 with render). Its credits page also lists bot-protected domains, including "Cloudflare Bypass" and "Cloudflare Turnstile Bypass" at 10 credits per scrape, and warns that domains may switch protection measures.

So measure before you scale: the API Playground and the /account/urlcost endpoint show the cost of a URL with a given set of parameters, and responses can carry an sa-credit-cost header with the credits a request used. Then escalate only as far as the site requires.

scraperapi_cloudflare.py
import requests

SA = "https://api.scraperapi.com"
KEY = "YOUR_SCRAPERAPI_KEY"
URL = "https://example.com/products"

# 0) See what this URL will cost before you scale up
est = requests.get(f"{SA}/account/urlcost",
                   params={"api_key": KEY, "url": URL, "render": "true"}, timeout=30)
print("estimated cost:", est.text)

def fetch(**opts):
    # ScraperAPI retries for up to 70 s before it answers 500: do not cancel earlier
    r = requests.get(SA, params={"api_key": KEY, "url": URL, **opts}, timeout=75)
    print(r.status_code, "credits:", r.headers.get("sa-credit-cost"))
    return r

def blocked(r):
    return r.status_code == 500 or "Just a moment" in r.text

r = fetch(render="true", wait_for_selector=".product-list")        # 10 credits
if blocked(r):
    r = fetch(premium="true", render="true", country_code="us")    # 25 credits
if blocked(r):
    r = fetch(ultra_premium="true")  # 30 credits (75 with render), paid plans only,
                                     # custom headers discarded, never with premium

Fix 2: use premium and ultra_premium correctly

The two premium tiers have rules that explain many "it still fails" reports:

  • premium=true activates a private pool of residential and mobile IPs for hard-to-scrape sites. It is available to all paid users.
  • ultra_premium=true is the higher tier for "really tough target websites", only on paid plans. Requests with it are cached by default, and all custom headers are discarded even if keep_headers=true is set.
  • The two are mutually exclusive: send one or the other, never both.
  • session_number (reuse the same proxy) cannot be combined with premium or ultra_premium.
  • country_code geotargets the proxies (for example country_code=us) and does not increase the cost.

Fix 3: render and wait for the real page

render=true activates JavaScript rendering. Pair it with wait_for_selector, which "instructs the API to wait until a specific element appears on the page" and must be used with render=true. Choose an element that only exists on the real page, so the response cannot be the Cloudflare interstitial.

device_type=mobile or desktop sets the kind of User-Agent ScraperAPI uses, and keep_headers=true makes it use your own headers (not with ultra_premium). If you send custom headers, keep them consistent with a real browser; a mismatched User-Agent is an easy signal for bot protection.

Fix 4: timeouts, concurrency and retries in your code

A few client settings prevent both failures and unexpected charges:

  • Set the HTTP client timeout to at least 70 seconds. ScraperAPI retries internally during that time, and a request cancelled earlier is billed.
  • Keep concurrency at or below your plan's threads (20 on Hobby, 50 on Startup, 100 on Business). Over the limit you get 429; ScraperAPI says requests over the limit are turned away rather than queued, without extra charge.
  • Retry 500s in your own code too: ScraperAPI recommends it, since errors can occasionally occur. For repeated anti-bot bans on one domain, its docs say to contact support.

What a Cloudflare-protected page costs on ScraperAPI

Prices checked 2026-12-01 on scraperapi.com/pricing (monthly billing): Hobby $49 for 100,000 credits, Startup $149 for 1,000,000, Business $299 for 3,000,000, Scaling $475 for 5,000,000. The trial gives 5,000 credits for 7 days with no card. Only 200 and 404 responses are charged.

By our arithmetic on the Startup plan, a premium plus render request (25 credits) is about $3.73 per 1,000 pages and an ultra_premium plus render request (75 credits) about $11.18 per 1,000. The Cloudflare bypass line lists 10 credits per scrape; the urlcost endpoint shows how it applies to your exact URL and parameters.

When a dedicated challenge solver is cheaper or simpler

A cf_clearance solver charges per clearance rather than per page. You solve the Cloudflare challenge once, receive the cookie and the matching User-Agent, and send the following requests with your own HTTP client through your own proxy. Cloudflare's default clearance lifetime is 30 minutes (each site can change it), and no new challenge is shown while it is valid.

This fits when the challenge is the only obstacle, the data is in HTML or a JSON endpoint, and you fetch many pages from the same few sites, especially where each page would otherwise need ultra_premium. NSLSolver charges $1.00 per 1,000 successful Cloudflare Challenge solves; your proxy traffic is extra.

ScraperAPI stays the simpler option when you need rendering on every page, structured data endpoints, many unrelated domains or no proxy management. NSLSolver covers Cloudflare Turnstile, Cloudflare Challenge, reCAPTCHA v3 / Enterprise, Kasada and Akamai (beta); it does not solve reCAPTCHA v2, hCaptcha, image or text CAPTCHAs, FunCaptcha, GeeTest or DataDome.

The same Cloudflare challenge with NSLSolver

POST the url, the challenge site_key (the 0x... widget id from the challenge page) and your proxy to /solve. The synchronous response contains cookies (including cf_clearance) and user_agent; replay both 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.

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.

nslsolver_challenge.py
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))

Frequently asked questions

Why does ScraperAPI return a 500 on a Cloudflare site?

ScraperAPI retried the request for up to 70 seconds and could not get a successful response. You are not charged. For protected domains, its docs suggest premium=true or ultra_premium=true, usually with render=true.

Does a ScraperAPI 403 mean Cloudflare blocked me?

No. ScraperAPI documents 403 as "You have exhausted the API Credits available in this monthly cycle." Upgrade, enable overages or contact support.

What is the difference between premium and ultra_premium?

premium=true uses residential and mobile IPs (10 credits, 25 with render). ultra_premium=true activates ScraperAPI's advanced bypass mechanisms (30 credits, 75 with render), is only on paid plans, discards custom headers and is cached by default. They cannot be combined.

How many credits does the Cloudflare bypass cost on ScraperAPI?

ScraperAPI's credits page lists Cloudflare Bypass and Cloudflare Turnstile Bypass at 10 credits per scrape for bot-protected domains, and recommends checking the exact cost in the API Playground or with the urlcost endpoint because domains can change protection (checked 2026-12-01).

I got a 200 but the page is a CAPTCHA. What now?

ScraperAPI asks you to contact support so the page is added to its detection database. In the meantime, use render=true with wait_for_selector on an element that exists only on the real page, and a premium tier.

What timeout should I use with ScraperAPI?

At least 70 seconds. ScraperAPI retries internally for up to 70 seconds, and requests you cancel before that are billed.

When is a cf_clearance solver cheaper than ScraperAPI?

When Cloudflare's challenge is the only obstacle and you fetch many pages from the same sites. One clearance stays valid for the site's Challenge Passage (30 minutes by default), so a $1.00 per 1,000 solve can cover many requests sent with your own client and proxy.

Solve the Cloudflare challenge once, replay it yourself

NSLSolver returns cf_clearance and the matching User-Agent in one synchronous call, at $1.00 per 1,000 successful solves. Free credit with Google, Gmail or Proton sign-up, no card needed.