ScraperFlyAI-ready Web Data API

developer api

HTML Scraping API for public page source capture

ScraperFly gives developers a practical HTML capture path for public pages: fetch source markup first, inspect what the target actually returns, and add rendering, sessions, headers, country targeting, or stronger routing only when they improve the response.

Source-first capture

Capture the markup first, then decide what the page really needs

ScraperFly gives teams a clean way to capture public HTML without turning every target into a browser job. Fetch the source response, see whether the useful markup is already there, and keep the request lightweight when the page does not need extra controls.

When a target does need more help, the same API path can add rendering, waits, headers, sessions, country routing, or stronger delivery with a clear reason behind each choice.

raw HTMLrendered HTMLparser-ready markup
Developer reviewing source HTML from a public page before choosing scraping controls

What is an HTML scraping API?

An HTML scraping API is a hosted endpoint that retrieves public page markup and returns it to your application through a stable API response. Your product can then parse links, headings, tables, metadata, product cards, article content, pagination, embedded data, or any other fields that are visible in the captured HTML. The API handles the request layer so your team can focus on the extraction logic and the downstream workflow.

The important distinction is that HTML scraping is not automatically the same as browser scraping. Many public pages send useful markup in the initial response. In those cases, a simple HTML request is faster, easier to debug, and usually cheaper than launching a browser. Other pages send a thin shell and rely on JavaScript to build the final DOM. Those pages may still be captured as HTML, but they need rendered HTML rather than raw source HTML.

Practical takeaway: use raw HTML first when the markup already contains the content, and move to rendered HTML only when JavaScript changes the captured page.

When is raw HTML enough?

Raw HTML is enough when the first response includes the information your parser needs. This is common for documentation pages, many articles, simple directories, static landing pages, server-rendered product pages, category listings, public profile pages, and pages that expose useful metadata or structured markup without browser execution. The request stays small, the output is easy to inspect, and the parsing rules can be built against a repeatable source response.

The best way to confirm this is to sample real target URLs. Check whether the title, main content, links, prices, dates, breadcrumbs, pagination, canonical URL, schema snippets, or embedded data are present in source HTML. If they are, adding a browser step may only increase latency and request weight. If they are missing, compare rendered output before assuming the page is impossible or jumping to heavier routing.

HTML signal What it tells you Recommended request profile
Main content is present in source HTML The page can likely be parsed without a browser Use format=html with rendering off.
Source contains only an app shell The visible content may be built by JavaScript Test rendered HTML before writing selectors.
Links and pagination exist in markup Crawling and discovery can start from raw HTML Keep the discovery request light.
Markup changes by region or session The target may need request context Test headers, cookies, country routing, or sessions deliberately.
HTML is complete but hard to read The parser may not need the full markup Consider text, Markdown, or structured metadata for downstream jobs.

How does ScraperFly make HTML capture easier to operate?

Teams can fetch HTML with a script, but production scraping becomes harder once targets behave differently. One page may be static. Another may need JavaScript. A third may require a language header, cookie state, country-specific routing, or stronger delivery. A fourth may return the correct status code but the wrong content. ScraperFly gives developers one request surface where those controls can be added only when the target proves they matter.

This keeps HTML scraping from turning into a patchwork of custom fetchers, proxy experiments, browser workers, retry loops, and output converters. The workflow stays understandable: send a public URL, choose HTML output, inspect the evidence, then decide whether raw source, rendered HTML, or a different response format is the right fit. When the request profile is proven, copy it into cURL, Postman, Python, Node.js, a backend job, a parser pipeline, or an agent workflow.

When should HTML scraping use JavaScript rendering?

Use JavaScript rendering when the useful HTML appears only after browser execution. That can happen on single-page applications, client-rendered product grids, search pages with frontend data loading, lazy sections, route-based interfaces, or pages where the initial response contains placeholders instead of the final content. In those cases, rendered HTML gives your parser the DOM after the browser has done the work.

Rendering should still be a measured choice. Start with raw HTML, compare it to rendered HTML, and enable rendering only when the difference matters. If rendered HTML gives you the same content as source HTML, keep the cheaper and simpler request. If rendered HTML reveals the target data, keep rendering for that page type and document why it is needed.

For deeper browser-specific decisions, use the JavaScript rendering API guide or the broader headless browser scraping API page. For this page, the core principle stays the same: HTML capture should be as simple as the target allows.

What should developers parse from HTML?

HTML is useful because it preserves structure. A parser can use selectors, attributes, links, tables, headings, microdata, embedded JSON, canonical tags, Open Graph metadata, pagination controls, and surrounding context. This is valuable when the downstream system needs more than plain readable text. For example, a price monitoring workflow may need product title, current price, currency, availability, and variant links. A content workflow may need headings, author, date, body sections, and internal links.

The cleanest parser is built after looking at real samples. Inspect stable elements, avoid brittle layout-only selectors, watch for repeated boilerplate, and separate page discovery from field extraction. If the target has multiple templates, sample each template before scaling. If the source HTML includes too much layout noise for an AI pipeline, consider whether text, Markdown, JSON metadata, screenshot, or PDF output is a better fit for that downstream step.

Workflow Useful HTML evidence Why HTML helps When to switch format
Link discovery Anchors, canonical links, pagination, navigation sections HTML keeps URLs and page relationships visible Use text only after discovery is complete.
Product monitoring Product cards, price nodes, availability, variants Selectors can target repeatable fields Use screenshots for human QA or visual proof.
Article extraction Headings, body sections, author, date, metadata Structure helps separate content from boilerplate Use Markdown when readable structure is enough.
Monitoring Status, final URL, response size, DOM changes HTML can be compared over time Use screenshots when visual regressions matter.
AI ingestion Source sections, links, headings, raw context HTML preserves maximum context before cleanup Use clean text or Markdown when the model does not need DOM details.

What mistakes make HTML scraping more expensive than it needs to be?

The most common mistake is treating every page as a hard target before the evidence says so. Rendering every URL, routing every request through premium delivery, adding long waits by default, or generating visual files for machine-only workflows can make a simple HTML job heavier than necessary. Another mistake is assuming that a successful HTTP status means the useful content is present. The response needs to be inspected, not just counted.

Good HTML scraping is deliberate. Start with the lightest request. Confirm whether source HTML contains the target data. Upgrade only the control that solves the observed problem. Use rendering for JavaScript-built content, sessions for shared state, headers for required request context, country routing for regional output, and premium delivery for targets that repeatedly fail through standard paths. That approach keeps request cost aligned with target behavior instead of guesswork.

Practical takeaway: the cheapest reliable HTML scrape is the one that returns complete markup with the fewest enabled controls.

How should teams start with ScraperFly?

Start in the API Builder. Send one public URL as HTML with rendering off. Inspect the source response and verify whether the fields are present. If the page is incomplete, enable rendering and compare the rendered HTML. If geography, cookies, headers, waits, or delivery strength change the output, add those controls one at a time so the request remains understandable.

Once the request profile is proven, use it as the template for production. Keep static pages on raw HTML, classify JavaScript-heavy templates separately, and reserve heavier options for the pages that truly need them. When planning larger runs, review pricing so request profiles match the workload before scaling.

HTML scraping

Fetch public HTML with a request profile that stays easy to reason about

Start with fast source HTML, inspect the response, and move to rendered HTML only when the page content is built in the browser. ScraperFly keeps the HTML capture path compact while leaving room for routing, headers, sessions, and output upgrades.

SRC
Source HTML

Use the lightest request when markup is already present

Static pages, docs, listings, and many product pages can be captured without a browser step.

format=htmlrender=false
JS
Rendered HTML

Turn on rendering when JavaScript owns the content

Rendered HTML helps when the initial source is only an app shell or the useful fields appear after client-side execution.

render=truewait
CTX
Context

Add request context when the target changes output

Headers, cookies, sessions, country targeting, and premium routing become targeted fixes instead of default complexity.

headerssessionscountry

HTML scraping controls to choose deliberately

url

The public page to capture as HTML.

format=html

The output mode for source or rendered markup.

render

Browser execution for client-side content.

render_wait

Controlled extra time for late-loading content.

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"

HTML fit

Confirm what the page exposes before upgrading the request

HTML scraping works best when target behavior is visible: source markup, JavaScript rendering, redirects, response size, geography, and session state all affect the cleanest setup.

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 scaling HTML scraping

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.

What changes the HTML request

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.

Light first

Keep HTML capture affordable by avoiding browser work when source HTML is enough

The simplest HTML fetch is often the best starting point. Rendering, premium routing, sessions, and country targeting add value only when they improve the response.

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 HTML scraping 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 HTML jobs 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.

Practical choice

Why ScraperFly is a stronger fit than raw proxy-only HTML fetching

Raw access is only one part of reliable HTML scraping. ScraperFly pairs HTML capture with rendering, routing, sessions, headers, formats, errors, and pricing paths that help teams move from test request to production workflow.

Happy team validating a project on a laptop
01 / Start easy

Easy, free start before any billing pressure

ScraperFly gives you room to test the real target first. Use free credits to check whether the page works, whether the data is present, and which controls are actually needed before you commit money to a plan. That makes the first experiment feel light: no procurement loop, no forced subscription, no guessing your monthly volume on day one.

Free creditsNo card for first testsValidate before scaling
Smiling professional working successfully with a laptop
02 / Spend smart

Affordable, flexible billing for real-world scraping volume

Not every scraping workload is a neat monthly curve. Some projects spike, some pause, and some only become recurring after the data proves value. ScraperFly supports that reality with a pay-as-you-go path plus monthly credit plans when steady volume makes sense. You can buy what you need, keep costs visible, and avoid turning a small test into an oversized subscription.

Pay as you goMonthly when usefulCost control
Developer preparing structured output from a laptop
03 / Ship faster

Response preprocessing that removes cleanup work

A cheap fetch is not enough if your team still has to build converters, cleaners, screenshots, PDF capture, and LLM-ready formatting around it. ScraperFly can return the response as HTML, clean text, Markdown, structured JSON, PDF, or image output, so your pipeline gets closer to the final asset in one request. Less glue code, fewer moving parts, faster delivery.

HTMLTextMarkdownJSONPDFImage

HTML scraping decisions that affect total delivery effort

The best setup returns complete markup with the fewest moving parts, then adds stronger controls only when the target proves they matter.

Decision pointScraperFly advantageTypical competitor tradeoff
First experimentStart with free credits and validate the real target before spending. You can prove whether raw HTML, rendering, premium routing, or country targeting is actually needed.Trials often push you quickly toward a recurring plan or hide the true cost until add-ons enter the request.
Billing modelUse pay-as-you-go credits for uneven work, then move to monthly credits only when the workload becomes predictable. This keeps small tests and project-based scraping affordable.Many tools are optimized around monthly subscriptions, fixed allowances, or tier gates that can feel heavy before volume is proven.
Request weightKeep simple pages simple. Turn on JavaScript rendering, premium routing, sessions, headers, waits, or country routing only when the response evidence says they matter.Comparable controls may exist, but they are often bundled into higher tiers, defaults, or more complex pricing profiles.
Output formatsReturn the response in the shape your product needs: HTML for parsers, text or Markdown for content pipelines, JSON for structured metadata, and PDF/image output for visual proof.Some providers focus mainly on access and leave formatting, capture, cleanup, and downstream preparation to your own code.
Developer workflowOne API surface can cover target testing, escalation, rendering, routing, sessions, headers, response formatting, and status checks. The path from prototype to production stays compact.Proxy-first tools, actor marketplaces, and crawler platforms can be powerful, but often require more glue code or a heavier operating model.
Best fitTeams that want practical web data delivery: start small, measure cost per useful result, and scale only the controls that improve the outcome.Teams with fixed high-volume contracts, custom proxy infrastructure, or broad marketplace crawler needs may prefer a more specialized platform.

HTML questions

Common questions about HTML scraping with ScraperFly

Practical answers for developers deciding when raw HTML is enough, when rendered HTML is needed, how to parse markup, and how to keep request profiles light.

HTML FAQ
Source HTML

Starting with raw markup

Raw HTML is the best first test when the page already exposes useful content.

Should I start with raw HTML or rendered HTML?

Start with raw HTML. If the source response contains the content your parser needs, keep the request light and avoid browser work.

What should I inspect in the first HTML response?

Check title, main content, links, tables, metadata, pagination, embedded data, response size, final URL, and whether the target fields are present.

Rendering

When HTML needs JavaScript

Rendered HTML is useful when browser execution changes the page.

When should I enable rendering for HTML scraping?

Enable rendering when source HTML is a thin shell, misses expected content, or differs materially from the page users see after JavaScript runs.

Does rendered HTML replace raw HTML?

No. It is an upgrade path for JavaScript-heavy pages. Static and server-rendered pages should usually stay on raw HTML.

Parsing

Building reliable extraction

Good parsing starts with stable evidence from real page samples.

Is HTML better than text or Markdown for parsing?

HTML is better when selectors, links, attributes, tables, or DOM relationships matter. Text and Markdown are better when the workflow only needs readable content.

How do I avoid brittle HTML selectors?

Sample real templates, prefer stable semantic attributes, avoid layout-only selectors, and verify that required fields appear across representative pages.

Cost

Keeping HTML capture efficient

The right profile returns complete markup without unnecessary controls.

Why is raw HTML often the cheapest starting point?

It avoids browser execution and extra delivery controls when the page already contains useful markup, so tests stay fast and affordable.

When should I add sessions, headers, or routing?

Add them only when the target output changes because of state, request context, region, or delivery path. Keep each control tied to evidence.