ScraperFlyAI-ready Web Data API

developer api

cURL Web Scraping API for public page capture

Use cURL to prove a ScraperFly request before writing integration code. Test a public URL, choose the response format, add rendering or request controls only when the target needs them, and move the same request shape into your app, Postman, Python, or Node.js workflow.

Terminal-first proof

Prove the request in cURL before the workflow disappears into code

cURL is the fastest way to see whether a scraping request is shaped correctly. The target URL, API key, output format, rendering choice, headers, sessions, and routing controls stay visible in one terminal command before a backend worker or SDK wrapper hides the details.

ScraperFly gives that terminal test a production path. Start with a clean public URL request, inspect the response, then add browser rendering, stronger routing, country targeting, headers, sessions, waits, screenshots, or PDFs only when the target proves they improve the result.

curl requestvisible controlscopy to code
Developer testing a cURL web scraping API request and reviewing the API response

How do you use cURL with a web scraping API?

Use cURL to send a public target URL and response options to a hosted web scraping API from the terminal. A good cURL workflow proves the page response first, then adds rendering, routing, headers, sessions, or visual output only when the captured evidence shows those controls are needed.

That makes cURL useful before any integration code exists. A developer can test one page, compare response formats, see status and content evidence, and hand the exact request shape to a teammate, API Builder, Postman, Python, Node.js, a queue worker, or a production job. The terminal command becomes a small contract: this is the URL, this is the output, these are the controls, and this is why they are enabled.

Practical takeaway: start with cURL when you need a transparent proof request before turning a public page capture workflow into application code.

Why should scraping tests start in the terminal?

Early scraping work fails most often because teams write code around a target they have not fully inspected. A script may hide the URL encoding, authentication, output format, redirect behavior, response size, or rendering decision behind helper functions. When the response is empty, blocked, too large, or missing the expected content, the team has to debug both the target and its own integration at the same time.

A terminal-first test keeps that first decision clean. cURL shows the raw request shape. You can copy it, adjust one parameter, compare the next response, and document the final version without touching application code. If the page is simple, the command stays simple. If the page needs browser rendering, sessions, headers, country routing, or stronger delivery, those controls are added with a reason that can be seen in the response.

This is especially useful when several people touch the workflow. A data engineer can prove the request, a backend developer can move it into code, and a product owner can understand why a heavier profile is required for one target but not another.

Terminal test What it proves Why it matters before code
Send one public URL The target can be reached through the API The team avoids writing integration logic around a bad or unrepresentative URL.
Choose an output format The response shape fits the downstream consumer Parsers, AI pipelines, QA flows, and archives need different outputs.
Compare raw and rendered capture JavaScript either changes the useful content or it does not Rendering becomes a precise choice, not a default expense.
Add headers or sessions deliberately Request context changes the returned public page The workflow keeps stateful controls tied to evidence.
Inspect errors in the terminal The failure is input, auth, format, target, limit, network, or rendering related Retries and escalation do not become guesswork.

What should the first cURL scraping request test?

The first request should answer one question: does the simplest public page capture give your workflow usable evidence? Send a real target URL, choose one output format, and inspect the status, final URL, content type, response size, and body. If the body contains the fields you need, the target may not need a browser, premium routing, long waits, or visual files. If the body is a thin shell, missing key content, redirected unexpectedly, or clearly different from the visible page, then you have a reason to test a heavier option.

Do not start by enabling every available control. That makes the first result harder to interpret. If the request succeeds, you do not know which option mattered. If it fails, you do not know which option created the problem. Start with a small profile, change one thing at a time, and keep the final command easy to explain.

For a cleaner starting point, use the API Builder to generate the canonical request, then copy the result into cURL, Postman, or backend code once the response is proven.

Which response format should a cURL workflow try first?

The right response format depends on the next system, not on habit. HTML is best when a parser needs DOM structure, selectors, attributes, links, tables, or embedded metadata. Text and Markdown are better when a content workflow, search index, RAG pipeline, or review tool needs readable page content without layout noise. JSON metadata helps with logging and diagnostics because it exposes operational evidence such as status, final URL, content type, and response details. Screenshots and PDFs are useful when humans need visual proof, QA review, compliance evidence, or archives.

cURL is good for this choice because it makes format testing quick. You can send the same public URL, request HTML, then text, then Markdown, then a visual output if the workflow needs it. The result is a decision about what the application can use immediately, not a pile of converters built before the team knows what the target returns.

Output to test Use it when Terminal decision
HTML Your parser needs structure, links, selectors, or embedded markup Use it as the first test for source-first capture.
Rendered HTML The useful DOM appears only after browser execution Compare against raw HTML before making rendering the default.
Text or Markdown The workflow needs readable content for search, summaries, or AI ingestion Choose the cleanest readable format your downstream tool can use.
JSON metadata You need operational context for logging, debugging, or request classification Use it to make response evidence visible in later automation.
Screenshot or PDF The result must be reviewed, archived, or proven visually Reserve visual output for workflows that need human-readable evidence.

When should a cURL request add rendering, headers, sessions, or routing?

Add controls when the response gives you a specific reason. Enable JavaScript rendering when source HTML is missing content that appears after browser execution. Add headers when a public target expects legitimate request context such as language, content type, or referer behavior. Use sessions when related requests depend on shared cookies or state. Add country routing when public content changes by location, language, currency, availability, or regional redirect behavior. Consider stronger routing when repeated evidence shows the simple path does not retrieve a usable response.

The point is not to keep every request minimal forever. The point is to keep each upgrade connected to the target. cURL helps because every option remains visible. If someone asks why a request uses rendering or premium routing, the answer should be in the sample history: raw HTML missed the content, the regional page changed, the session carried necessary state, or the target repeatedly failed through the lighter path.

For pages that depend heavily on browser execution, compare the JavaScript rendering API path. For stateful request flows, use the sessions API page. For request context, review custom headers.

How should developers move from cURL to production code?

Move only the proven request shape into code. The application should not inherit every experimental option that was tried in the terminal. Keep the final request profile small, name why each control exists, and log the response evidence that matters for the workflow. That makes future failures easier to diagnose because the team can compare production behavior to the original terminal proof.

Python and Node.js integrations should own scheduling, queues, parsing, storage, alerting, retry policy, and business logic. ScraperFly should own the public page capture layer: request delivery, rendering when needed, output formats, routing controls, and response evidence. cURL sits between those worlds. It proves the API request before the integration turns it into reusable code.

When the request is stable, hand it to the right implementation path: Python for scripts, notebooks, data jobs, and analysis workflows; Node.js for backend services, queues, agents, and web applications.

What mistakes make cURL scraping tests misleading?

The biggest mistake is testing an easy URL and assuming the whole target set behaves the same way. A production workflow should sample the actual page types: static pages, JavaScript-heavy pages, regional pages, pages with redirects, pages that may require state, and pages where visual proof matters. Another mistake is using cURL as a full crawler plan. cURL proves a request. It does not replace scheduling, discovery logic, parser design, storage, monitoring, or retry discipline.

It is also easy to leave test-only controls in the final profile. Long waits, rendering, stronger routing, screenshots, and PDFs can be helpful, but they should not stay enabled just because they were tried once. Keep the command readable. Keep the output tied to the downstream consumer. Keep request cost aligned with what the target actually needs.

Practical takeaway: a good cURL test is not the most powerful request you can build; it is the clearest request that proves what production should send.

Where should a team start?

Start with one real public URL in the API Builder, generate the cURL command, and run it from the terminal. Inspect the response before writing wrappers or workers. If the content is present, keep the request light. If it is missing, add one control at a time and compare the result. Once the command is proven, move the same request shape into the implementation that owns the rest of the workflow.

For output decisions, use the response formats guide. For cost planning, review pricing after you know which request profiles your real targets require.

cURL workflow

Test a ScraperFly request from the terminal before adding SDK code

Use the terminal to keep every request choice visible: target URL, output format, rendering, routing, headers, sessions, waits, and file output. Once the response is proven, the same request shape can move cleanly into Postman, Python, Node.js, or a backend job.

cURL
Terminal first

Start with one copyable request

A cURL command makes the URL, authentication, format, and request controls explicit before application code hides the moving parts.

curlapikeyurl
FMT
Output choice

Pick the response your toolchain expects

Return HTML for parsers, text or Markdown for content pipelines, JSON metadata for diagnostics, or visual files when humans need proof.

htmlmarkdownjson
CTRL
Delivery controls

Add controls after the first response

Rendering, premium routing, country targeting, sessions, headers, and waits are easier to justify when the first sample shows what is missing.

renderheaderssessions

cURL parameters worth testing first

url

The public page to fetch, render, convert, or capture.

format

The output shape returned to the terminal or script.

render

Browser rendering for JavaScript-built pages.

premium

Stronger routing for targets that reject the simple path.

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"

Before the cURL grows

Keep the terminal test small until the target response proves complexity

A cURL workflow is useful because every option stays visible. Inspect status, content type, response size, redirects, JavaScript dependency, and output quality before adding more request controls.

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 adding more flags

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 each answer changes the cURL 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.

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.

Cost-aware testing

Use cURL samples to find the lightest request that still works

Small terminal tests help avoid expensive defaults. Try the simple profile first, then add rendering, premium routing, sessions, or file output only when the response proves the upgrade is useful.

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.

Controls that can change cURL request 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 terminal tests economical

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.

cURL questions

Common questions about cURL web scraping requests

Practical answers for developers using cURL to validate ScraperFly request shape before moving public page capture into code.

cURL FAQ
REQUESTS

Making the first request

Use cURL to prove the target and response shape before integration work starts.

Can I test ScraperFly from cURL?

Yes. cURL is a good first step for testing a public URL, response format, rendering choice, and request controls before the workflow moves into backend code.

Should I hand-write the cURL command?

You can, but the API Builder is safer for the first version because it keeps the request canonical and easier to copy into Postman, Python, Node.js, or a job runner.

OUTPUT

Choosing a response

The best output is the one your downstream tool can use without extra cleanup.

Which output should I try first?

Try HTML when you need markup for parsing. Try text or Markdown for readable content workflows. Use JSON metadata for diagnostics and screenshots or PDFs for visual review.

Can cURL test screenshots or PDFs?

Yes. Visual outputs can be part of the request shape when the workflow needs proof, QA review, or archives rather than only machine-readable content.

CONTROLS

Adding complexity

Controls should solve a visible response problem, not appear in every sample by default.

When should I enable rendering in a cURL test?

Enable rendering when source HTML misses useful content that appears after browser execution. If raw HTML already contains the data, keep the request lighter.

Can I test headers, sessions, or country routing?

Yes. Add them when the public page changes by request context, continuity, language, currency, location, or routing behavior.

HANDOFF

Moving into code

The final command should become a clear request profile, not a pile of experiments.

What should production code inherit from cURL?

Move the proven request shape into code: URL handling, output format, and only the controls that improved the response during testing.

Does cURL replace crawling or parsing logic?

No. cURL proves the API request. Your application still owns scheduling, discovery, parsing, storage, retries, and product-specific business logic.