ScraperFlyAI-ready Web Data API

developer api

Web Scraping API for production-ready public web data

ScraperFly gives developers one practical API layer for public web data: start with fast HTML requests, switch to clean text, Markdown, JSON metadata, screenshots, or PDFs, and add rendering, sessions, headers, country routing, or premium routing only when the target proves it needs them.

Main API layer

Build the request profile before your product depends on the data

A web scraping API gives your product one dependable way to fetch public web pages, inspect the response, and return usable output without owning every moving part of scraping infrastructure. Your team sends a target URL and a clear request profile. ScraperFly handles the capture layer, then returns HTML, text, Markdown, JSON metadata, screenshots, or PDFs in the shape your workflow can use.

The practical advantage is control. A simple page should stay a light HTML request. A JavaScript page can be rendered when the useful content is missing from source HTML. A hard target can add sessions, headers, country routing, or premium delivery after the response proves those controls are needed. That path keeps testing cheaper, production behavior easier to explain, and engineering time focused on the product instead of browser and proxy maintenance.

request profileresponse formatscontrolled escalation
Developer testing a web scraping API request with response format controls

What does a web scraping API actually replace?

A web scraping API replaces the capture infrastructure around public page retrieval. Without it, a team often has to maintain HTTP clients, browser workers, proxy pools, retry logic, timeout rules, header forwarding, session state, output converters, screenshot capture, PDF generation, logs, and monitoring around every target. That work can be useful for a very specialized platform, but it is rarely the core value of the product that needs the data.

ScraperFly moves that operational layer behind one API surface. The application still owns what matters downstream: choosing targets, parsing fields, validating data quality, storing records, comparing changes, generating alerts, or feeding AI and analytics systems. ScraperFly focuses on getting a public page response into a dependable shape so the next system starts from evidence instead of a fragile homemade fetch.

Practical takeaway: use a web scraping API when your product needs public page evidence, not another internal platform for browser, proxy, retry, and conversion work.

How should the first request be built?

The first request should be intentionally boring. Send the public URL, ask for the smallest useful output, and inspect the result. If source HTML contains the content your parser needs, keep the request simple. If the page returns only a thin app shell, empty markup, or content that appears after frontend JavaScript runs, enable rendering for that target. If the response changes by language, consent state, location, or previous steps, then evaluate headers, cookies, sessions, or country routing.

This is the same logic reflected in the page’s request-builder block below: build one reliable request, then add controls only when the target proves it needs them. The point is not to hide advanced features. The point is to keep each feature attached to a reason. Rendering solves browser-created content. Sessions preserve state across related requests. Headers carry legitimate request context. Premium or country routing helps when delivery evidence shows the default path is not enough. Screenshots and PDFs create visual proof when machine-readable output alone cannot tell the full story.

Request decision Start with Add more when Why it matters
Basic public page capture URL plus HTML output Source HTML is incomplete or unusable Keeps the first test fast, cheap, and easy to debug.
JavaScript-created content Raw HTML comparison The browser changes the useful content Rendering becomes an evidence-based control, not a default tax.
Stateful or regional pages Simple request with response metadata Language, cookies, route state, or location changes the response Sessions, headers, and routing stay tied to target behavior.
Review, QA, or archive workflows Machine-readable output Someone needs proof of how the page looked Screenshots and PDFs complement parsable data instead of replacing it.

Which response format should the API return?

The best response format is the one your next system can use with the least cleanup. HTML is right when selectors, tables, links, attributes, or DOM relationships matter. Rendered HTML is useful when frontend JavaScript creates the markup your parser needs. Text is lighter when the workflow only needs readable page content. Markdown helps AI, RAG, summarization, documentation, and review workflows because headings and links remain easier to understand than plain text.

JSON metadata is useful for operational context: status, final URL, content type, timing, and response details that help logs and debugging. It does not replace custom extraction. Screenshots and PDFs serve a different job: visual evidence. They help with monitoring, QA, compliance review, approvals, and archives, but they are heavier and usually less convenient for machine parsing.

Diagram showing a target URL, ScraperFly request controls, and supported response formats
A practical ScraperFly request starts with the public target URL, then adds only the controls and output formats the downstream workflow actually needs.
Output Best suited to Main advantage Trade-off
Raw or rendered HTML DOM parsing, selectors, tables, links Preserves structure and page relationships Requires parser logic and cleanup downstream
Text Search, indexing, lightweight analysis Compact and easy to process Removes most structural context
Markdown AI, RAG, summaries, content review Keeps readable headings, lists, and links Not ideal for precise DOM extraction
JSON metadata Logging, diagnostics, workflow routing Makes request evidence easier to inspect Does not replace target-specific field extraction
Screenshot or PDF QA, monitoring, approvals, archives Shows what the rendered page looked like Heavier and less convenient for parsing

When do rendering, sessions, headers, and proxy routing matter?

Advanced controls matter when they solve a specific target problem. Browser rendering matters when the data is created after JavaScript execution. Waits matter when the browser loads the right state late. Headers matter when the public target expects legitimate context such as language, content type, referrer, or a specific user-agent pattern. Sessions matter when related requests depend on shared cookies or route state. Country routing matters when public content changes by location, currency, availability, or regulation. Premium routing matters when response evidence shows standard delivery is not returning a usable page.

That order is important. Enabling everything at once can make a request more expensive, slower, and harder to diagnose. A better workflow is to test representative pages, compare the response size and content, inspect the final URL and status, and then choose the smallest request profile that reliably produces the needed artifact. This also makes production recovery clearer: if a target starts returning a redirect, timeout, empty shell, or unexpected content type, the team knows which part of the request profile to review.

Practical takeaway: add rendering, sessions, headers, routing, or visual output when the response proves they improve capture quality, not because they are available.

How does ScraperFly keep the buying path lower-risk?

A scraping project often starts uncertain. The team may not know whether the target is static, JavaScript-heavy, location-sensitive, session-dependent, or difficult to deliver. Locking that work into heavy infrastructure or a large recurring plan before testing the target creates risk. ScraperFly is positioned for a simpler path: start with free credits, validate real pages, buy credits when a project needs them, and move to monthly credits when recurring demand is clear.

That model fits the technical workflow. A light request should stay light. A heavier rendered or routed request should be used when it creates value. Visual files should be generated when someone needs visual proof. The API Builder supports the same buying logic because it lets the team inspect a real request before writing glue code or scaling batches. Cost control is not just a pricing concern; it is a request-design habit.

What should stay downstream from the scraping API?

ScraperFly should not be framed as a magic extractor that turns every public page into a perfect dataset. The API captures public page output and provides controls for rendering, routing, sessions, headers, formats, and visual evidence. Your product still decides what the data means. Field mapping, entity normalization, deduplication, quality checks, alerts, scoring, storage, and business logic stay downstream where they belong.

This boundary makes the product more trustworthy. A web scraping API should help a developer obtain reliable source evidence and then let the application apply its own rules. That is especially important for AI, monitoring, analytics, and automation workflows, where bad source evidence can lead to bad summaries, false alerts, duplicate records, or expensive retries.

Screenshot and PDF capture used as visual proof for a public web page
Visual outputs are best used as reviewable proof alongside machine-readable HTML, text, Markdown, or metadata.

Where should a team go after understanding the basics?

The next step is to build a real request, not a theoretical architecture. Use the API Builder to test a public URL, compare output formats, and decide whether the page needs rendering, sessions, headers, routing, or visual capture. If the main question is output shape, review the web scraping API response formats page. If the page is JavaScript-heavy, compare the result against the JavaScript rendering API guidance. If state matters across requests, the sessions API page explains when shared context is useful.

Once the request profile is proven, move it into the backend, worker, agent, parser, monitor, or archive workflow that needs the data. That is the core ScraperFly promise: one practical API layer for public web data, with controls that stay visible from the first test to production.

Developer workflow

Build one reliable web scraping API request, then add controls only when the target proves it needs them

Start with a clean public URL fetch, inspect the response, and add rendering, sessions, headers, country routing, premium proxies, or richer output formats only when the target proves they are needed.

GET
Canonical request

Start with the target URL

Send a public URL through one API surface and keep the first request easy to inspect before adding heavier controls.

urlformatrender
CTX
Request context

Add context when evidence requires it

Use headers, cookies, sessions, waits, and country routing as explicit decisions tied to the response you see.

headerssessionscountry
OUT
Usable output

Return data in the shape your app needs

Choose HTML, text, Markdown, JSON metadata, screenshots, or PDFs so the next system receives useful evidence.

htmlmarkdownjsonpdf

Core controls to explain on this page

url

The public page ScraperFly fetches, renders, converts, or captures.

format

The response shape: HTML, text, Markdown, JSON, screenshot, or PDF.

render

Turn on browser rendering only when JavaScript creates the content.

premium

Escalate routing only when the target response proves simple delivery is not enough.

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"

Target first

Map the page behavior before choosing the scraping profile

Diagnose the target before choosing a scraping profile. Static HTML, JavaScript-rendered content, session behavior, headers, geography, file output, and response size all change the right request shape.

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.

Questions to answer before scaling

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 those answers change the 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.

Cost control

Keep simple requests light and pay for heavier delivery only when it creates value

Raw HTML keeps the baseline light. Rendering, premium routing, and richer response formats are deliberate upgrades when they make the downstream workflow faster, cleaner, or more reliable.

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 usually changes credit weight

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 the first run practical

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.

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.

Buyer questions

Common questions before choosing a web scraping API

Answer the practical evaluation questions around request formats, JavaScript rendering, proxies, sessions, credits, and supported public page workflows.

Evaluation FAQ
Requests

Making API requests

For developers wiring ScraperFly into agents, jobs, backend services, or quick tests.

What do I send to ScraperFly?

Send a target URL plus the output format you need. The API can return HTML, clean text, Markdown, JSON, screenshots, or PDFs depending on the request options.

Should I use GET or POST?

Both can produce the same scraping result. GET is convenient for simple query parameters; POST is better when you want a clear JSON body or longer request options.

Can I test a request before coding?

Yes. The API Builder generates the endpoint, JSON body, query parameters, and code samples, then lets you send a live request from the dashboard.

Output

HTML, text, Markdown, and JSON

Choose the smallest output that your product actually needs.

When should I use clean text?

Use clean text when you need readable page content for summaries, classification, search indexing, or LLM prompts without layout markup.

What is the JSON output for?

JSON is useful when you want structured metadata, headings, links, text, and Markdown in one response that is easier to inspect programmatically.

Is Markdown different from clean text?

Markdown keeps more content structure, such as headings and lists. Clean text is flatter and better when formatting is less important.

Rendering

JavaScript pages

Use browser rendering only when the target page needs it.

When do I enable render=true?

Enable rendering for SPAs, JavaScript-injected product pages, lazy-loaded content, or pages where the source HTML does not contain the data you need.

Does rendering always cost more?

Yes, browser work is heavier than a basic HTML fetch. Start without rendering, then enable it only for targets that genuinely require JavaScript execution.

Can I control viewport and wait time?

Yes. Screenshot and PDF requests can use viewport dimensions and render wait options so the captured page has time to settle.

Routing

Proxies and location

Route requests through standard or premium pools when target behavior changes.

When do I need premium proxy routing?

Use premium routing for stricter targets, higher block rates, unstable responses, or pages that behave differently under normal datacenter traffic.

Can I request a country?

Yes. Add a country option when the target content depends on location, currency, language, availability, or regional redirects.

Are sessions supported?

Session-style workflows can reuse context across related requests when continuity matters for pagination, locale changes, or multi-step scraping.

Files

Screenshots and PDFs

Capture rendered pages when a visual artifact is the required output.

Can ScraperFly return a screenshot?

Yes. Screenshot output captures the rendered page as an image file, including JavaScript-rendered content when rendering is enabled.

Can ScraperFly generate a PDF?

Yes. PDF output is useful for receipts, reports, archives, compliance snapshots, and pages that need to be saved as a document.

Where do generated files appear?

Registered dashboard users can save and download generated artifacts from request logs when the request produces a downloadable file.

Credits

Costs and credits

Credits track delivery work rather than idle infrastructure.

How many credits does a request use?

A simple HTML, text, Markdown, or JSON request usually uses fewer credits. Rendering, premium routing, screenshots, and PDFs use more because they require heavier delivery work.

Do pay-as-you-go credits expire?

Pay-as-you-go credits stay available until you use them. They are a good fit for uneven workloads or projects that do not need a monthly plan.

Do subscription credits roll over?

Yes. Monthly plan credits refresh every month and unused credits roll over. If payment fails after Stripe retries, the account falls back to Pay as you go.

Security

Keys, headers, and safety

Keep credentials on your backend and forward only the headers you intend to use.

Where should I store my API key?

Store the API key server-side or in a trusted environment. Avoid exposing production keys in public frontend bundles or static pages.

Can I forward request headers?

Yes, selected headers such as user-agent, accept-language, cookie, and referer can be forwarded when a target expects realistic request context.

Does ScraperFly bypass private access controls?

No. It is designed for fetching public web pages and pages you are allowed to access, not for bypassing authentication or private systems.

Billing

Plans, logs, and invoices

Use the dashboard to understand what happened and why credits changed.

Where can I inspect usage?

The dashboard records request logs, credit balance changes, output formats, proxy routing, durations, and billing events so you can audit usage.

Can I download invoices?

Paid transactions include invoice data when Stripe provides it, so invoice PDFs can be opened from the financial log.

How do I manage a subscription?

Subscribed users can open the customer portal to change payment details, review invoices, or cancel. Free and Pay as you go users can go to Pricing instead.