17 min

Scrapfly API Documentation: Web Scraping, Cloud Browser & Screenshots

Comprehensive guide to Scrapfly's Web Scraping, Cloud Browser, and Screenshot API documentation. Learn setup, anti‑bot bypass, credit system, and how AdsCrawl fits browser automation workflows.

AAnonymous

Scrapfly API Documentation: Your Complete Guide to Web Scraping, Cloud Browser, and Screenshot APIs

Scrapfly offers a unified web data platform with one API key to handle anti‑bot bypass, stealth browser sessions, and visual capture. Whether you need raw HTML, a real Chromium browser over CDP, or pixel‑perfect screenshots, the documentation covers every endpoint. This guide walks through the essentials, from your first API call to advanced workflows, so you can extract data confidently.

Getting Started with Scrapfly APIs

Scrapfly API Documentation: Web Scraping, Cloud Browser & Screenshots product interface and feature overview

Scrapfly API Documentation: Web Scraping, Cloud Browser & Screenshots product interface and feature overview.

Before diving into the endpoints, set up your account and grab an API key. The Scrapfly login process is simple: register, verify, and access your keys from the dashboard. Once authenticated, every request includes your key as a query parameter or header, and the platform starts tracking usage right away.

A minimal call to the Web Scraping API looks like this:

curl "https://api.scrapfly.io/scrape?key=YOUR_KEY&url=https://example.com"

The response is a clean JSON envelope that tells you whether the scrape succeeded, which proxy was used, and the full HTML content. Scrapfly charges on success only—failed anti‑bot challenges don’t consume credits.

Scrapfly Web Scraping API

Scrapfly API Documentation: Web Scraping, Cloud Browser & Screenshots product interface and feature overview

Scrapfly API Documentation: Web Scraping, Cloud Browser & Screenshots product interface and feature overview.

The Web Scraping API is the workhorse. It fetches any URL with anti‑bot bypass, automatic proxy rotation, and optional JavaScript rendering. You get structured data out of the box:

  • url – target page
  • render_js – toggle headless Chromium rendering for SPAs
  • asp – enable anti‑bot bypass (handles Cloudflare, DataDome, Akamai, and more)
  • country – geo‑target the exit IP
  • format – receive raw HTML, clean markdown, or JSON

The response includes result.content, result.status_code, and result.antibot ("bypassed" or "blocked"). If a challenge fails, it doesn’t cost you—Scrapfly pricing follows a “pay‑on‑success” model, so your top‑up rolls over only for delivered data.

How Anti‑Bot Bypass Works

Scrapfly builds every bypass layer in‑house. The platform uses two stealth engines: a proprietary HTTP client (Curlium) and a stealth Chromium browser (Scrapium). When you set asp=true, the request goes through a pipeline that matches JA4 fingerprints, H2 frame settings, and QUIC alignment, all while rotating residential or datacenter proxies across 190+ countries. The result is a 98% success rate on protected sites, as measured by the Scrapeway benchmark.

Scrapfly Cloud Browser

For workflows that need a real, interactive browser session, the Cloud Browser exposes a stealth Chromium instance over CDP. It’s fully compatible with Playwright and Puppeteer, so you can drive clicks, fills, and navigation before extracting data or taking screenshots.

# Connect via WebSocket
wss://browser.scrapfly.io/cdp?key=YOUR_KEY

Benefits over self‑hosted browsers:

  • No infrastructure to maintain
  • Built‑in anti‑bot and fingerprint randomization
  • Session persistence for multi‑step flows
  • Pay only for successful actions

The Cloud Browser is ideal for login‑wall protection, complex form submissions, and scenarios where a simple HTTP request isn’t enough. It complements the Web Scraping API by giving you full CDP control when you need it.

Scrapfly Screenshot API

The Screenshot API captures any page—or specific element—as a PNG, JPEG, WebP, GIF, or PDF. It runs on real Chromium with the same anti‑bot bypass engine as the scraping endpoints. A minimal GET request:

https://api.scrapfly.io/screenshot?url=https%3A%2F%2Fexample.com&key=YOUR_KEY

Capture Pipeline

Every screenshot flows through a composable pipeline:

  1. Anti‑bot bypass – solvable before the page loads
  2. Ad‑block & banner dismissoptions=block_banners removes cookie popups and overlays
  3. JS scenarios – click, fill, scroll, and wait for selectors or network idle
  4. Capture – full‑page, viewport, or CSS/XPath‑targeted element
  5. Optimize – server‑side compression; format and quality tuning
  6. Deliver – binary image in response body or a cached URL via log_url

Wait Conditions and Viewport Control

Timing is everything. Use wait_for_selector, wait_until (networkidle, domcontentloaded), or a fixed rendering_wait to fire the shutter at the right moment. Combine with custom viewports (resolution, dpr) and auto_scroll=true to force lazy‑loaded content into view.

Scheduled Captures and Visual Diffs

Beyond one‑off captures, the Screenshot API supports recurring snapshots on cron schedules. Each run is stored and pixel‑diffed against the previous one, making it perfect for visual regression testing, competitive monitoring, and AI training datasets. Failed captures consume zero credits, and you can set a cost_budget to cap spending.

Screenshot + Data in One Call

If you need both the image and structured data, you’re not limited to the Screenshot API. The Web Scraping API supports a screenshots[name]=fullpage parameter, delivering HTML extraction alongside the snapshot in a single request.

Combining APIs for Complex Workflows

Scrapfly’s product suite is designed to compose. For example:

  • Use the Crawler API to traverse a site, then feed each discovered URL to the Web Scraping API for structured content.
  • Spin up a Cloud Browser session to log into a dashboard, then call the Screenshot API on the same session for a pixel‑perfect report.
  • Feed scraped HTML into the Extraction API, which uses LLM‑powered prompts to return typed data.

The official Scrapfly docs detail every parameter and provide code examples for Python, Node.js, and curl.

Scrapfly vs. Alternatives for Browser Automation & Screenshots

Scrapfly API Documentation: Web Scraping, Cloud Browser & Screenshots product interface and feature overview

Scrapfly API Documentation: Web Scraping, Cloud Browser & Screenshots product interface and feature overview.

While Scrapfly provides a broad scraping and capture platform, some teams need a more focused anti‑detect browser automation solution. AdsCrawl is such an alternative—it’s a browser automation and data extraction API built specifically for the AI era. Unlike Scrapfly’s unified scraping‑first design, AdsCrawl turns real cloud browser sessions into simple APIs, outputting screenshots, HTML, and Markdown, with remote CDP control when you need it.

Key differentiators:

  • Anti‑detect profiles: AdsCrawl integrates directly with AdsPower for fingerprint profiles (user agent, timezone, WebGL, WebRTC), giving you fine‑grained stealth without managing multiple services. For guidance, see the AdsCrawl fingerprint settings guide.
  • Developer‑focused simplicity: AdsCrawl’s API is designed to be composable; you can manage concurrent sessions, monitor usage transparently, and start with a free tier. The AdsCrawl API overview walks through typical workflows.
  • Use cases: If your primary goal is SEO audits, price monitoring, or lead research that demands undetectable browser sessions right out of the box, AdsCrawl may feel more purpose‑built. Scrapfly, on the other hand, shines when you need a full scraping pipeline with crawling, extraction, and broad anti‑bot coverage.

Both platforms offer credit‑based pricing, but AdsCrawl’s model is tailored for browser session duration and output variety, while Scrapfly’s scales with request complexity. For a side‑by‑side breakdown, check the top anti‑detect platforms comparison where we rank AdsCrawl #1.

Common Troubleshooting Tips from the Scrapfly Docs

Even the most reliable APIs hit snags. Here’s what the documentation tells you to watch for:

  • HTTP 422 errors: The request was valid but failed—check the X-Scrapfly-Reject-Code and X-Scrapfly-Reject-Description headers for details. Often it’s a temporary target issue.
  • Concurrency limits: If you hit 429 Too Many Requests, you’ve reached your plan’s concurrency ceiling. The response headers X-Scrapfly-Account-Concurrent-Usage and X-Scrapfly-Account-Remaining-Concurrent-Usage tell you where you stand.
  • Budget control: Use the cost_budget parameter to cap spending per request and avoid accidentally burning credits on high‑cost targets.
  • Dashboard transparency: Every request generates a log_url so you can replay the full timeline—including redirects, load times, and rendered HTML—in the web dashboard.

Related reading

Sources and further reading

Frequently Asked Questions

How do I get my Scrapfly API key?

Sign up at scrapfly.io, verify your email, and grab your key from the dashboard. The key is used in the key query parameter or an Authorization header.

What’s the difference between the Web Scraping API and the Screenshot API?

The Web Scraping API returns HTML/text content and can optionally attach a screenshot. The Screenshot API is optimized purely for image capture, with a simpler GET‑based interface and built‑in ad blocking, full‑page scroll, and format options. If you need data, start with the Web Scraping API; if you just need a picture, the Screenshot API is faster and cheaper.

How does the credit system work?

Credits are consumed per successful request. Failed bypasses are free. The cost per request depends on the complexity—e.g., proxy type, JavaScript rendering, and anti‑bot passthrough. You can monitor cost via response headers (X-Scrapfly-Api-Cost). For a detailed breakdown, check the Scrapfly pricing guide.

Can I use Scrapfly with Playwright or Puppeteer?

Yes—the Cloud Browser exposes a CDP WebSocket endpoint. You can connect any Playwright or Puppeteer script by pointing to wss://browser.scrapfly.io/cdp?key=.... This gives you full browser control with Scrapfly’s stealth and proxy infrastructure underneath.

Is there an alternative for focused anti‑detect automation?

AdsCrawl provides a dedicated anti‑detect browser API with integrated AdsPower fingerprint profiles, remote CDP, and multi‑format output. It’s worth exploring if you need pure browser automation rather than a full scraping platform. See the AdsCrawl pricing and plans for a fit assessment.

Wrapping Up

Scrapfly API Documentation: Web Scraping, Cloud Browser & Screenshots product interface and feature overview

Scrapfly API Documentation: Web Scraping, Cloud Browser & Screenshots product interface and feature overview.

Scrapfly’s documentation spans a rich set of capabilities—from basic URL fetching to complete cloud browser sessions and scheduled screenshot monitoring. By understanding the Web Scraping API, Cloud Browser, and Screenshot API, you can build resilient data pipelines that handle modern web challenges. For teams that lean more heavily into undetectable browser automation, AdsCrawl offers a complementary approach with deep fingerprint management and developer‑first APIs. Explore both, test their free tiers, and choose the right tool for your stack.