JavaScript Rendering API for Scraping Dynamic Websites

Add render_js: true to any request and ScrapeBadger loads the page in a real headless browser, runs its JavaScript, and returns the fully rendered HTML, Markdown or text. Built for single-page apps, infinite scroll and lazy-loaded data.

One parameterWait for any CSS or XPath selector6 credits per rendered pageFailed requests cost 0 credits

1,000 free credits · No credit card required

Request
curl -X POST https://scrapebadger.com/v1/web/scrape \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "render_js": true}'
Response200 OK
{
  "success": true,
  "url": "https://example.com",
  "status_code": 200,
  "format": "html",
  "engine_used": "browser",
  "credits_used": 6,
  "content": "<html>...fully rendered page...</html>"
}

What is a JavaScript rendering API?

A JavaScript rendering API is a scraping API that opens each URL in a headless browser, lets the page's JavaScript run, and only then returns the content. A plain HTTP request gets the HTML the server sends first. On React, Vue, Angular and Next.js sites that's often an empty shell, because the products, prices and reviews are injected later by JavaScript. A JS rendering API returns what a user actually sees.

With ScrapeBadger you don't run or scale browsers yourself. You send a URL and render_js: true; the browser, proxies and retries are handled on our side.

When You Need JavaScript Rendering

Plain HTTP requests only return the initial HTML. These kinds of pages need a real browser before the data exists.

Single-page apps

React, Vue and Angular sites that build the page in the browser.

Infinite scroll

Feeds and listings that load more items as you scroll.

Lazy-loaded data

Images, reviews and prices that load after the first paint.

Client-side routing

URLs that change without a full page load.

Dynamic pricing & stock

Values fetched by JavaScript after the page loads.

How to tell if a site needs it

Open the page, then view the raw source (Ctrl+U / Cmd+Option+U). If the data you want is in the browser but missing from the source, the site renders client-side and needs render_js: true. If it's in the source, leave rendering off and pay 2 credits instead of 6.

How JavaScript Rendering Works

STEP 01

Send the request

Add render_js: true. Optionally add wait_for with a CSS selector or XPath for the element you need.

STEP 02

A real browser loads the page

It runs the page's JavaScript and waits until your element appears, or until load if you didn't set one.

STEP 03

You get the rendered result

As HTML, Markdown or plain text, plus an optional PNG screenshot. Every response includes engine_used and credits_used.

Render JavaScript With One Parameter

Fixed sleeps either waste time or fire too early. wait_for holds the response until a specific element exists, so you get the data the first time.

Request
import requests

resp = requests.post(
    "https://scrapebadger.com/v1/web/scrape",
    headers={"x-api-key": "YOUR_API_KEY"},
    json={
        "url": "https://example.com/products",
        "render_js": True,
        "wait_for": ".product-card",   # CSS selector or XPath
        "format": "markdown",
    },
    timeout=120,
)

data = resp.json()
print(data["engine_used"], data["credits_used"])
print(data["content"][:500])
Response200 OK
{
  "success": true,
  "url": "https://example.com/products",
  "status_code": 200,
  "format": "markdown",
  "engine_used": "browser",
  "credits_used": 6,
  "retries_used": 0,
  "blocking_detected": false,
  "content": "## Trail Runner 2\n$129.00\n..."
}

If the element never shows up within wait_timeout (default 30 s), the request fails with a wait_for_timeout error instead of returning a half-loaded page, and nothing is charged.

Browser Controls You Can Add to a Rendered Request

Everything runs on the same /v1/web/scrape endpoint. Mix and match per request.

ParameterWhat it does
render_jsForces the headless browser engine before content is extracted
wait_forWaits for a CSS selector or XPath before returning
wait_timeoutHow long to wait for wait_for, 1,000–120,000 ms (default 30,000)
wait_after_loadExtra dwell after page load, 0–30,000 ms
js_scenarioOrdered browser actions before extraction: click, fill, scroll, wait, evaluate
eval_jsRuns your JavaScript in the page and returns its result as content
screenshot / screenshot_full_pageReturns a PNG of the viewport or the full scrollable page
window_width / window_heightSets the viewport size, for mobile vs desktop layouts
session_idKeeps cookies, fingerprint and storage across requests
countryRoutes the request through a proxy in a specific country (37+ available)
anti_botRuns a solver when Cloudflare, DataDome, Akamai or Kasada blocks the page

Full reference: Scrape URL in the ScrapeBadger docs.

What a Rendered Page Costs

Rendering runs a real browser, so it costs more than a plain HTTP fetch. The difference is that you only pay for it when you ask for it, and only when it works.

RequestCredits
Plain page, default proxy tier2
JS-rendered page, default proxy tier6
JS-rendered page, premium proxy tier13
Anti-bot solver (only when a solver actually runs)+5
wait_for, js_scenario, eval_js, screenshot, video+0

Failed requests cost 0 credits

Retries on blocks are free too.

Escalation isn't cumulative

With escalate: true, a request that starts on HTTP and moves to the browser is billed for the browser only.

Set a ceiling

max_cost rejects any request that would go over your credit limit.

No surprises

Every response returns credits_used and an X-Credits-Used header.

Using It as a JavaScript-Rendering Crawler

ScrapeBadger renders pages; your crawler decides which pages to visit. Crawl logic (queues, link discovery, dedupe) stays in your code, in any language, while the API handles the browser work for each URL.

Only render what needs it

Category and listing pages often need render_js; static pages like blog posts or sitemaps don't. Leaving it off drops a page from 6 credits to 2.

Keep state between pages

Use session_id so cookies, consent banners and logins carry over.

Let blocks fall through

Retries on blocks are automatic and free, and failed requests cost nothing, so a rough patch doesn't burn credits.

Cap the spend

Set max_cost on every request so no single URL goes over budget.

Best APIs for Scraping JavaScript-Rendered Websites

What to look for, and how the main scraping APIs handle JavaScript rendering.

  • Real browserLive rendering, not pre-rendered caches.
  • Wait conditionA selector or XPath, so you don't rely on sleeps.
  • Browser actionsScroll, click and form fill before extraction.
  • Anti-bot handlingOn the same request, since JS-heavy sites are often protected too.
  • Clear billingWhat a rendered page costs, and whether failures are charged.

How the main APIs handle JavaScript rendering

APIHow to turn it onCredits per JS-rendered request
ScrapeBadgerrender_js: true6  (5 browser + 1 default proxy)
ScraperAPIrender=true10
ScrapingBeerender_js (on by default)5  (25 with premium proxy)
Scrapflyrender_js=true5
ScrapingdogJS rendering option5

Credit costs from each provider's documentation, October 2026. Credit prices differ between providers and plans, so compare cost per 1,000 rendered pages on the plan you'd actually buy.

Frequently Asked Questions

What is a JavaScript rendering API?

A JavaScript rendering API loads a URL in a headless browser, runs the page's JavaScript, and returns the rendered content. It lets you scrape React, Vue, Angular and other client-side sites without running browsers yourself.

How do I know if a site needs JS rendering?

Compare the raw page source with what you see in the browser. If the data you need is missing from the source, the site renders client-side and needs render_js: true. If it's already in the source, skip rendering and save credits.

How much does JavaScript rendering cost?

A JS-rendered page costs 6 credits on the default proxy tier, against 2 credits for a plain page. Waits, browser actions, screenshots and retries add nothing, and failed requests cost 0 credits.

Can I use the JavaScript rendering API with Scrapy?

Yes. Scrapy doesn’t run JavaScript on its own, so send each page URL from your spider to the scrape endpoint with render_js: true and parse the returned content with your existing selectors. Your item pipelines stay the same.

How does ScrapeBadger compare with ScraperAPI for JavaScript rendering?

ScraperAPI turns on rendering with render=true and charges 10 credits per rendered request. ScrapeBadger uses render_js: true at 6 credits, with free retries, free failed requests and a max_cost cap per request. Credit prices differ, so compare cost per 1,000 pages on your plan.

Can I wait for a specific element to load?

Yes. Pass a CSS selector or XPath in wait_for and the response is held until that element exists, up to wait_timeout (30 seconds by default, max 120).

Can I combine JS rendering with anti-bot bypass and geo-targeting?

Yes. Add anti_bot: true and a country code to the same request. The solver only adds credits when it actually runs.

Start Scraping JavaScript-Rendered Sites

Use 1,000 free credits to render SPAs, infinite scroll and lazy-loaded pages with one parameter.

No credit card required · Failed requests cost 0 credits