ScraperFlyAI-ready Web Data API

request control

Request control hub for reliable web scraping API workflows

Use request controls to make scraping behavior explicit: send the right headers, preserve cookies when needed, choose GET or POST, diagnose empty HTML, separate 403 from 429, and escalate only when response evidence justifies it.

Request control is the difference between guessing and operating a scraping workflow deliberately. A useful API request should make the target URL, method, headers, cookies, user-agent, language, authentication, rendering choice, waits, response format, and retry behavior visible enough to debug.

ScraperFly is built for that practical path. Start with the lightest request, inspect the evidence, then add the specific control that the target actually needs. This keeps simple pages simple and makes harder targets easier to reason about.

Use request controls to explain the response

A failed or incomplete scrape is not always a proxy problem, a rendering problem, or a target problem. It may be a missing header, a wrong content type, a language mismatch, a cookie continuity issue, a rate limit, an oversized response, a redirect, or a browser wait that does not match how the page loads.

The job of a request-control workflow is to separate those cases. Each control should answer a specific question: does the target expect a user-agent? Does it need an accepted language? Does it rely on cookies? Does the source HTML contain the data? Did the target return 403, 429, 5xx, or a tiny HTML shell?

Control area Use it when What it helps prove Common next step
Headers and user-agent The target expects language, content type, referer, or realistic request context Whether the response changes when legitimate context is present Compare status, content type, and response size
Cookies and sessions Public page behavior depends on continuity, preferences, consent, or related requests Whether state changes the captured content Preserve cookies only inside related workflows
Errors and rate limits The response returns 403, 429, 5xx, timeout, redirect, or empty content Whether the failure is input, pressure, routing, target, or render behavior Retry, back off, adjust context, or escalate with evidence
Response size and format The response is too large, too small, or not shaped for the downstream system Whether the workflow needs narrower capture or a different output Choose HTML, text, Markdown, JSON metadata, screenshot, or PDF

Escalate from evidence, not from frustration

It is tempting to fix every scrape by adding rendering, premium routing, long waits, sessions, and more retries. That can work sometimes, but it also makes every request heavier and harder to diagnose. A better workflow reads the response first.

If the page returns source HTML with useful data, keep the request light. If the page returns a JavaScript shell, test rendering. If the target blocks the request, compare headers, user-agent, country routing, or premium delivery. If the response is too large, narrow the capture. If the request is rate limited, back off instead of increasing pressure.

Practical takeaway: every request control should have a reason. Use the smallest control set that turns the target response into usable evidence.

REQUEST FIT

Map the target behavior before changing request controls

Headers, cookies, sessions, rendering, waits, routing, and retries should answer a target-specific question. Compare source response, rendered output, status, final URL, size, and content type before changing the request profile.

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 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 this changes in request 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.

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.

API BUILDER

Test headers, cookies, method, rendering, and output before production

Build the request profile in a controlled way before wiring it into a job. That makes it easier to see whether a header, cookie, render flag, wait, or output format actually changes the captured result.

HTML
Raw response

Raw HTML for parsers and crawlers

Use the fastest path for static pages, listings, docs, and product pages. Fetch the original source HTML first, then switch on browser rendering when JavaScript creates the markup your scraper needs.

format=htmlrender=falserender=true
TXT
Clean data

Text, Markdown, and JSON

Skip the cleanup layer after page access. Return readable text for agents, Markdown for prompts and RAG, or structured JSON with metadata, links, headings, clean text, and Markdown ready for your pipeline.

format=textformat=markdownformat=json
PDF
Visual files

Screenshots and PDFs

Capture what a real browser sees when you need QA evidence, archived proof, visual regression checks, downloadable reports, or shareable page records for customers and internal teams.

format=screenshotformat=pdfdownload

Controls that keep requests predictable

url

The target page to fetch, render, clean, or capture.

format

Select the response your product needs: html, text, markdown, json, screenshot, or pdf.

premium

Escalate to stronger routing for blocks, unstable targets, or geo-sensitive content.

render

Run Chromium for SPAs, JS-injected markup, screenshots, PDFs, and browser-only pages.

country

Request a country-specific route when content changes by location.

keep_headers

Forward selected request context such as user-agent, cookie, language, and referer.

render_wait

Give dynamic content a controlled extra wait before extraction or capture.

download

Return visual artifacts as downloadable files when the output is screenshot or PDF.

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"

REQUEST WEIGHT

Keep control changes tied to cost and evidence

Adding rendering, premium routing, downloads, screenshots, PDFs, waits, or repeated retries can increase request weight. ScraperFly helps teams keep simple pages light and escalate only when the response proves it is worth it.

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 a request 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 request weight 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.

REQUEST FAQ

Common questions about scraping request controls

Practical answers for teams deciding which headers, cookies, sessions, user-agent, retries, rendering, and diagnostics belong in a reliable scraping workflow.

Request answers
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.