ScraperFlyAI-ready Web Data API

rendering

JavaScript Rendering API for public web scraping

Modern websites often ship content through JavaScript after the first response. ScraperFly gives developers a JavaScript rendering API for public pages when raw HTML is empty, thin, or missing the data. You can keep simple requests light, render only when necessary, and return the response in the format your workflow actually needs.

Render with evidence

Use browser execution when it makes the response complete

ScraperFly helps teams compare source HTML with the rendered page state before committing a workflow to browser execution. That makes JavaScript rendering a precise capture option, not an expensive default for every URL.

Use it when the useful public content appears after client-side code runs, then return the result as rendered HTML, text, Markdown, metadata, screenshot, or PDF.

raw vs renderedwaitsoutput choice
Developers comparing source HTML with rendered JavaScript output on a public page

What is a JavaScript rendering API?

A JavaScript rendering API is a hosted request layer that can execute page JavaScript before returning the response. Instead of maintaining browser workers yourself, your application sends a public target URL and rendering options to the API. The API can open the page in a browser environment, wait for client-side content, and return rendered HTML, readable text, Markdown, JSON metadata, screenshots, or PDFs depending on the workflow.

This matters because many public websites no longer place every important field in the first HTML response. The source response may contain scripts, placeholders, hydration data, route containers, or empty elements that become useful only after the browser runs. Rendering closes that gap when the final page state is materially different from the source.

Practical takeaway: use JavaScript rendering when browser execution changes the data, page state, or visual evidence your workflow receives.

How can a team tell whether rendering is necessary?

The best first step is comparison. Request the same public URL without rendering, then request it with rendering enabled. Look at status code, final URL, response size, source HTML, rendered HTML, visible text, metadata, and screenshot state. If raw HTML already contains the required content, rendering may add cost and latency without adding value. If rendered output contains the fields your parser or review workflow needs, rendering has a clear purpose.

Teams get into trouble when they treat JavaScript rendering as a default instead of an evidence-based option. Browser execution is powerful, but it can mask simpler solutions. Some pages expose useful data in server-rendered markup, structured script payloads, canonical metadata, or static links. Others truly require rendering because the application builds the useful DOM after network calls, route hydration, user-visible state changes, or lazy loading.

Signal What it means Best next action
Raw HTML contains the target data The page is usable without browser execution Keep the request simple and parse the source response.
Raw HTML is a thin shell The page likely depends on client-side rendering Test rendering and compare the rendered DOM.
Rendered output is still empty The page may need wait timing, session state, headers, or a different route Inspect evidence before retrying or escalating.
Screenshot shows useful content but text output does not The visual state and machine-readable output disagree Compare output format and extraction assumptions.
Only some targets need rendering The workload has mixed request profiles Classify targets instead of rendering the whole batch.

Which JavaScript page patterns usually need rendering?

Rendering is most useful for public pages where the browser builds the content that users actually see. This can include single-page applications, product grids that hydrate after load, search result pages that update after frontend requests, infinite-scroll lists, pages with lazy sections, route-based content, or visual states that matter for QA. The page might return a valid response while the useful data arrives later through browser-side execution.

Not every JavaScript asset makes rendering necessary. A page can use JavaScript for analytics, tracking, navigation, layout effects, consent banners, or minor interactions while still delivering the important content in source HTML. The decision should be based on the captured result, not on whether the page has scripts.

Page pattern Why rendering may help What to verify Common mistake
SPA route The visible page can be assembled after route hydration Rendered title, body content, links, and state Parsing the empty app shell.
Product or listing grid Items may appear after frontend network activity Card count, prices, availability, pagination signals Stopping before async data is visible.
Lazy content Sections can appear after time, viewport changes, or deferred scripts Whether the required section appears in rendered output Adding random waits without evidence.
Visual QA page Humans need proof of how the rendered page looked Screenshot or PDF state Using visual files as the main parser input.
Mixed static and dynamic pages Some URLs need the browser and others do not Representative samples from each template Rendering every URL in the batch.

How should rendering fit into a production scraping workflow?

A production workflow should treat rendering as one request profile, not as the whole architecture. Start with raw HTML for a representative public URL. If it is incomplete, enable rendering. If rendering is useful, decide whether the workflow needs rendered HTML for DOM parsing, text or Markdown for content pipelines, JSON metadata for diagnostics, screenshots for visual monitoring, or PDFs for archive-style review.

From there, keep the request profile explicit. A page may need rendering but not screenshots. Another may need a screenshot but not Markdown. A third may need wait timing because content arrives late. Some targets may need session continuity, headers, country routing, or premium delivery. ScraperFly lets teams add those controls when the response proves they matter, which keeps the integration easier to reason about and cheaper to operate.

What should the API return after JavaScript rendering?

The output should match the downstream job. Rendered HTML is useful when a parser needs DOM structure, attributes, links, tables, or selector-based extraction. Clean text can support search, classification, deduplication, lightweight monitoring, or simple content analysis. Markdown is often useful for AI and RAG workflows because it preserves readable headings, lists, and links without carrying the full page layout. JSON metadata helps logging and diagnostics by exposing request context such as status, content type, final URL, and response details.

Screenshots and PDFs solve a different problem. They provide visual evidence for QA, monitoring, compliance review, archive workflows, or human approval. They are rarely the best source for machine parsing, but they are valuable when the question is not only “what text did we receive?” but also “what did the rendered public page look like at capture time?”

Practical takeaway: render the page when needed, then choose the smallest output format that your product can use directly.

What causes blank or partial rendered output?

Blank rendered output does not always mean the target cannot be scraped. It can mean the request reached the wrong final URL, content loaded after the wait window, a script failed, a consent or location state changed the view, the target returned a fallback, the response was too large, or the requested output format did not match the actual page state. Retrying blindly can repeat the same bad request and spend credits without learning anything new.

Good diagnostics compare evidence. Check the source response, rendered response, final URL, status, response size, content type, timing, screenshot state, and any routing or header assumptions. If the rendered screenshot shows the content but the text output does not, the issue may be output selection. If neither source nor rendered output shows the content, the page may require a different timing, session, route, or a narrower target decision.

How can teams control JavaScript rendering cost?

Rendering is heavier than a basic fetch because the request asks the platform to run browser work. That extra work is justified when JavaScript execution unlocks content, creates visual proof, or makes the response usable. It is wasteful when the same data is already available through a lighter request. Cost control begins with classification: simple pages stay simple, JavaScript-heavy pages render, and visual outputs are generated only for workflows that need them.

ScraperFly supports that buying path. Developers can test free or small runs, compare request profiles in API Builder, understand output choices through response formats, and use pricing to estimate request weight before scaling. For pages that clearly require browser execution, the headless browser scraping API path provides the broader browser-capture context.

Where should a developer start?

Start with one representative public page. Send the URL without rendering, inspect the result, then enable JavaScript rendering only if the source response is incomplete. Add wait timing only if the rendered page still misses late content. Choose rendered HTML, text, Markdown, JSON metadata, screenshot, or PDF based on what the downstream workflow needs. When the request profile is proven, copy it into cURL, Postman, Python, Node.js, your backend, an agent, or a monitoring job.

The goal is not to make every scrape a browser scrape. The goal is to make JavaScript rendering available exactly where it turns an incomplete public page response into useful data, cleaner content, or trustworthy visual evidence.

JavaScript rendering

Find out whether JavaScript changes the data you receive

Many pages load a complete HTML response. Others need JavaScript before listings, prices, articles, reviews, links, or metadata appear. ScraperFly gives teams a clean way to compare raw and rendered responses before adding browser work to every request.

Raw HTML response mapped to visible page data
01

Raw HTML availability

Check whether the fields you need are already present in the first HTML response.

Best first test for simple pages, articles, docs, listings, and product details.

Before and after JavaScript rendering comparison
02

JavaScript dependency

Compare raw HTML with the rendered DOM or screenshot before turning on browser rendering.

Use rendering when raw HTML is only a shell and scripts create the useful content.

Cookies, consent, session and access context for scraping
03

State & access context

Identify whether cookies, consent, login boundaries, pagination, or the same visitor state affect the response.

Use sessions and headers when continuity changes the data you receive.

Regional content variations across countries and routes
04

Geo/content variation

Test whether country, language, currency, inventory, SERP, ads, or route reputation changes the result.

Use geo or premium routing only when the target proves the response varies by route.

Checks before enabling JavaScript rendering

Where is the target field?

Find whether the field exists in raw HTML, rendered DOM, an API call, structured data, a file, or a later interaction state.

What changes the response?

Sample a few URLs and compare status, final URL, content length, redirects, empty states, and visible result differences.

What context is required?

Mark any dependency on consent, locale, cookies, headers, authentication boundary, pagination, filters, or previous requests.

What does failure look like?

Define the signals for blocked, partial, stale, redirected, empty, timed-out, or region-mismatched responses before scaling.

How JavaScript changes scraping setup

Fetch mode

Raw HTML availability decides whether the first request can stay simple or needs rendering, waits, screenshots, or extraction.

Request context

State requirements decide whether to add headers, cookies, sessions, consent handling, or a stable visitor profile.

Routing choice

Geo and reputation findings decide whether standard routing is enough or a country/premium route is justified.

Validation rules

Known failure states become checks for retries, escalation, QA review, and deciding when a lighter profile is still complete.

Rendered response builder

Add JavaScript rendering when it improves completeness, not by habit

Use raw HTML for fast tests, then enable rendering for client-side pages, lazy-loaded sections, route transitions, and visual proof. Keep the request shape readable from first sample to backend integration.

RAW
Raw response

Start with fast HTML capture

A simple request often reveals whether the page already contains the data your parser needs.

htmlrender=false
JS
Rendered response

Run JavaScript for client-side content

Rendering helps capture content that appears after frontend code, API calls, route hydration, or lazy loading.

render=truewait
OUT
Output choice

Return the format that fits the downstream job

Rendered HTML, text, Markdown, JSON-oriented metadata, screenshots, and PDFs serve different parsing and QA workflows.

markdownjsonscreenshot

Controls that shape JavaScript-rendered scraping

url

The public page being tested.

render

Browser execution for client-side content.

wait

Timing control for async content and late network activity.

format

The response shape your workflow needs.

cURL example

Generate Markdown with the same request shape you can move into production

curl "https://scraperfly.com/api/v1?url=https%3A%2F%2Fexample.com&format=markdown" \
  -H "apikey: YOUR_API_KEY"

Error handling

Turn scraping failures into fixes

Every web data workflow eventually meets a bad response: a missing URL, an invalid key, an empty HTML shell, a target 403, a rate limit, a render timeout, a broken PDF capture, or a JSON payload that does not contain the fields your product expected. ScraperFly is built to make those moments diagnosable. You inspect the HTTP status, the stable error code, the request profile, and the returned artifact, then choose the cheapest useful next move: fix the request, add credits, slow down, retry with backoff, enable rendering, change country, use premium routing, preserve headers, or validate the output before scaling.

Stable error shapeRetry decisionsCost-aware escalationOutput validation
Developer reviewing code and API request parameters on a laptop

01 / Request setup and access

Fix request mistakes first

Some failures are not target problems at all. They happen before ScraperFly can make a meaningful delivery attempt: a missing or malformed URL, an unsupported output format, an incompatible visual file type, a missing API key, an invalid key, or a key that has been paused or disabled. These errors are configuration signals, not retry signals: stop the workflow, point the developer to the exact field that needs correction, and keep credits focused on real target tests instead of repeated bad inputs.

missing_urlinvalid_urlunsupported_formatinvalid_api_key
  • Validate the URL and encoding before sending a batch.
  • Use supported outputs: HTML, text, Markdown, JSON, screenshot, or PDF.
  • Match screenshot file types to image output and PDF file type to PDF output.
  • Treat missing or invalid API keys as configuration work, not retry work.
Business dashboard with charts, documents and usage planning on a desk

02 / Credits, limits and concurrency

Separate limits from failures

A workload can fail because the account has no usable credits, the monthly plan limit has been reached, or concurrency is too aggressive for the current plan and target mix. ScraperFly makes those limits visible as operating signals, not mysterious scrape failures. That keeps the buying decision practical: start free, test the target, buy pay-as-you-go credits for uneven jobs, move to monthly credits when volume becomes predictable, and use backoff when request pressure is the real issue.

usage_limit_reachedrate_limitedcreditsbackoff
  • Use account status to check remaining credits before large runs.
  • Retry rate limits with backoff instead of immediately increasing pressure.
  • Keep one-off projects on pay-as-you-go when volume is uneven.
  • Move predictable recurring work to monthly credits when the pattern is proven.
Server room representing delivery paths, routing and network infrastructure

03 / Target delivery and network

Find delivery failures first

Many scraping platforms collapse delivery issues into a vague request failure. In production, that is not enough. The team needs to know whether the request timed out, the upstream target returned a temporary server error, the connection failed, the response was too large, redirects went somewhere unexpected, or the page came back as tiny HTML with no useful content. ScraperFly turns those failures into delivery evidence: try the light profile first, compare status and response size, then decide whether the next request needs backoff, another route, premium proxy, country targeting, or a narrower capture.

timeout5xxredirectsresponse_too_large
  • Retry temporary network and upstream failures with a controlled backoff policy.
  • Compare final URL, status, content type and response size across samples.
  • Escalate routing only when the response proves the simple path is unstable.
  • Treat oversized responses as a scope problem before scaling the same profile.
Digital security screen representing anti-bot and protected access signals

04 / Anti-bot, geo and access blocks

Read blocks before escalation

A target 403, 401, 429, CAPTCHA screen, WAF challenge, login wall, consent loop, or region-specific mismatch is not just an error; it is a clue about what the site expects from the visitor. Competitors often push teams toward a heavier default profile, but that can burn budget without proving the fix. ScraperFly's better path is evidence-based escalation: preserve realistic headers when context matters, use sessions when continuity changes the response, enable rendering when the useful content is browser-built, and choose premium or country routing when reputation or geography changes the result.

403429CAPTCHAcountry mismatch
  • Use premium routing when IP reputation is the proven bottleneck.
  • Use country targeting when language, currency, inventory or search results change by market.
  • Use headers, cookies and sessions when visitor state changes the response.
  • Reduce concurrency and add backoff when repeated requests trigger target throttling.
Developer preparing code and output artifacts on a laptop

05 / Rendering and output quality

Ship usable artifacts

A 200 status is not the same thing as a usable scrape. The raw HTML can be an empty app shell, Markdown can miss the main article, JSON can lack expected metadata, text can include noise, screenshots can be blank, and PDF or image output can fail if the browser step times out. ScraperFly is valuable because the same API request can move from raw HTML to rendered DOM, clean text, Markdown, JSON, screenshot or PDF, then be checked against the artifact your product actually needs. That reduces glue code, failed imports, and expensive batch runs that only discover bad output after the fact.

render_timeoutbrowser_render_failedJSON fieldsPDF/image output
  • Enable rendering when raw HTML is only a shell and the useful content appears after JavaScript.
  • Validate text, Markdown and JSON against expected fields before batching.
  • Use screenshot or PDF output when visual proof or audit evidence matters.
  • Treat blank or partial artifacts as quality failures even when HTTP status is successful.
ScraperFly fit

Cleaner error recovery

ScraperFly helps teams decide what to fix, what to retry, and what to escalate without turning every scrape into the most expensive request profile.

Stable error shape

Use HTTP status and error code together so application logic can choose between fixing input, refreshing credentials, slowing down, retrying, or escalating delivery.

Retry only when it helps

Network failures, rate limits, and temporary server errors can use backoff. Invalid URLs, unsupported formats, and bad keys should be corrected once.

Cost-aware escalation

Start with the light request profile, then add rendering, premium routing, country, sessions, headers, waits, or visual capture only when the failure proves it.

Validate output before scale

Confirm the real artifact your product needs: HTML, text, Markdown, JSON, screenshot, or PDF, before copying the same profile across a large URL set.

Rendering economics

Spend browser credits where JavaScript actually changes the result

Rendering is worth it when it unlocks content or proof. For simple pages, raw HTML, text, or Markdown can keep jobs faster and more affordable.

A lightweight HTML request returning a simple response
01

Basic fetch

Use a basic fetch when public HTML already contains the fields you need.

Lightest request profile; keep it when the response is complete.

JavaScript rendering producing a complete DOM
02

Rendering

Use rendering when raw HTML is a shell and JavaScript completes the page.

Heavier profile; use it only when browser output changes the result.

Several requests preserving cookies and visitor state
03

Stateful session

Use sessions when cookies, consent, locale, or pagination change the response.

Heavier state profile; preserve it only when continuity matters.

Request routing through geo and higher quality routes
04

Premium routing & geo

Use premium routing or geo only when origin, country, reputation, or regional content changes the result.

Heaviest routing profile; apply it only to targets that prove they need it.

What makes JavaScript rendering heavier

More infrastructure work

Browser rendering, routing choices, and longer waits mean the platform has to do more than return a simple response.

More target uncertainty

Redirects, empty states, rate limits, and challenge pages often require stronger delivery options or retries.

More state to preserve

Cookies, sessions, consent, and multi-page flows add moving parts that a plain stateless fetch does not have.

More evidence to return

Screenshots, PDFs, rendered output, and richer response artifacts are useful, but they are heavier than plain HTML.

How to keep rendering usage predictable

Sample before scale

Test a small URL set first and group targets by the lightest profile that returns complete data.

Do not render by default

Inspect raw HTML before turning on rendering. Many public pages already contain the data you need.

Escalate by evidence

Move up only when the response shows missing content, state dependency, geo variance, or routing problems.

Measure useful results

Optimize around valid records delivered, not raw request volume. A lighter profile is best only when it stays complete.

Rendering questions

Common questions about JavaScript rendering for web scraping

Practical answers for teams deciding when to render JavaScript, what to inspect, which output to request, and how to keep browser usage under control.

Rendering FAQ
Decision

When rendering is needed

Rendering should be tied to missing or incomplete content.

Should I enable JavaScript rendering for every page?

No. Start without rendering and compare the result. Enable rendering only when browser execution adds useful content, page state, or visual evidence.

What is the strongest sign that rendering is necessary?

The source HTML is thin or incomplete, while the rendered response contains the target data, links, text, listings, or visible state your workflow needs.

Setup

Rendering controls

A rendered request can still stay focused and predictable.

When should I add a wait?

Add a wait when the browser renders the page but important content appears late. Use evidence from samples instead of adding long waits by default.

Do JavaScript pages always need sessions or custom headers?

Not always. Use sessions when related requests depend on shared state, and use headers only when the public workflow requires specific request context.

Output

Choosing response format

Rendered pages can return different outputs for different jobs.

Should I request rendered HTML, text, or Markdown?

Use rendered HTML for DOM parsing, text for lightweight analysis, and Markdown when readable structure helps content, AI, or RAG workflows.

When are screenshots or PDFs useful?

Use screenshots and PDFs when the workflow needs visual proof, QA, review, monitoring, or archives. They usually complement machine-readable outputs.

Cost

Keeping rendering efficient

Browser work should stay connected to real target behavior.

Does rendering always increase request weight?

Rendering is heavier than a basic HTML fetch because it runs browser work. Keep static targets on lighter requests and reserve rendering for pages that prove they need it.

How do I avoid wasting credits on retries?

Inspect final URL, status, response size, source HTML, rendered HTML, timing, and screenshot state before repeating the same rendered request.