Scrapfly API Guide: Web Scraping, Browser & Screenshots
Learn to use Scrapfly's web scraping API, cloud browser, and screenshot API with step-by-step cURL and Python examples. Includes AdsCrawl alternative.
Scrapfly API Guide: Web Scraping, Browser & Screenshots
Scrapfly packs a full web data platform into a single API key: anti‑bot bypass, stealth Chromium over CDP, residential proxies, screenshots, and structured extraction. Whether you need raw HTML, a live browser session, or crisp full‑page captures, the platform reduces the stack to one call. This guide walks through the three core surfaces – the Web Scraping API, the Cloud Browser (CDP), and the Screenshot API – with real cURL examples and a look at how an alternative like AdsCrawl fits into the picture.
What Is Scrapfly?
Scrapfly is a web data collection platform that handles the heavy lifting behind large‑scale scraping. Instead of patching headless browsers, managing proxy pools, and fighting bot‑detection, you send one HTTP request. The response returns the rendered page content, anti‑bot status, proxy details, and optional screenshots. The stack owns its own stealth engines (Curlium for HTTP and Scrapium for Chromium), a global proxy mesh, and a credit‑based billing model where failed bypass attempts do not consume credits.
The platform exposes seven products through one API key: Web Scraping API, Cloud Browser, Screenshot API, Extraction API, Crawler API, AI Browser Agent, and an MCP Server. We focus on the first three.
Getting Started with Scrapfly
- Sign up at scrapfly.io and grab your API key.
- All endpoints live under
https://api.scrapfly.io/. Authentication is a simplekeyparameter. - Usage is tracked in credits. Failed anti‑bot bypasses are free; successful requests cost credits based on target complexity.
For any call below, replace __API_KEY__ with your actual key.
Web Scraping API Tutorial
The /scrape endpoint is the workhorse. It fetches a URL, optionally renders JavaScript, and returns the final HTML.
Basic cURL Request
curl -G \
--url "https://api.scrapfly.io/scrape" \
--data-urlencode "key=__API_KEY__" \
--data-urlencode "url=https://httpbin.org/html" \
--data-urlencode "render_js=false"
Typical JSON Response (trimmed)
{
"success": true,
"result": {
"status_code": 200,
"duration": 1.24,
"antibot": "bypassed",
"proxy": "residential/us",
"browser": "chrome/148",
"content": "<!doctype html><html>..."
}
}
Key parameters you’ll use often:
render_js=true– executes JavaScript on the page (needed for SPAs).country=us– forces a proxy exit in a specific country.format=markdown– returns Markdown instead of raw HTML.
Anti‑bot bypass is automatic: no per‑site configuration. If the request succeeds, the antibot field will read "bypassed". If it fails, the response tells you and you aren’t charged.
Extracting Clean Data
For structured data, pair the scrape call with the Extraction API or use built‑in templates. The guide focuses on the raw API; the documentation at Scrapfly Docs covers LLM‑powered extraction with prompts and JSON schemas.
Cloud Browser (CDP) Overview
When you need full browser control, Scrapfly offers a real Chromium instance over the Chrome DevTools Protocol. You connect via WebSocket and drive it just like a local Playwright or Puppeteer session – but it runs on Scrapfly’s infrastructure with stealth patches and residential IPs.
# The WebSocket endpoint
wss://browser.scrapfly.io/cdp?key=__API_KEY__
You can launch Playwright or Puppeteer with this endpoint. For example, with Playwright:
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.connect_over_cdp("wss://browser.scrapfly.io/cdp?key=__API_KEY__")
page = browser.new_page()
page.goto("https://example.com")
print(page.title())
The cloud browser is ideal for scenarios where you need to click, type, or wait for complex user interactions before capturing data. Unlike the scrape endpoint, you retain full session control. Should you need similar real‑browser CDP sessions with a freemium model and fingerprint profiles, AdsCrawl provides a unified API for screenshots, HTML/Markdown extraction, and CDP control – something to keep in mind when evaluating Cloud Browser offerings.
Screenshot API Tutorial
Scrapfly gives you two ways to take screenshots:
- Dedicated Screenshot API – simplest approach, fully driven by GET parameters.
- Screenshots via the Web Scraping API – attach screenshot capture to a scrape request for advanced control (CSS selectors, flags).
Option 1: Standalone Screenshot API
A minimal call:
curl "https://api.scrapfly.io/screenshot?url=https://example.com&key=__API_KEY__" -o screenshot.png
Useful parameters:
format=jpg|png|webp|gif– choose output format.auto_scroll– scroll to the bottom to trigger lazy‑loaded content.options=block_banners– hide cookie modals and ads.js– execute custom JavaScript before the shot.
Example with auto‑scroll and banner blocking:
curl -G \
--url "https://api.scrapfly.io/screenshot" \
--data-urlencode "key=__API_KEY__" \
--data-urlencode "url=https://web-scraping.dev/product/1" \
--data-urlencode "auto_scroll=true" \
--data-urlencode "options=block_banners" \
--data-urlencode "format=png" \
-o product.png
Option 2: Screenshots Inside a Scrape Request
When you need to capture specific elements or combine a screenshot with scraped content, use the screenshots parameter on the /scrape endpoint (requires render_js=true). The official documentation at Scrapfly Screenshot Feature details the flags.
Full page + a CSS selector:
curl -G \
--url "https://api.scrapfly.io/scrape" \
--data-urlencode "render_js=true" \
--data-urlencode "url=https://web-scraping.dev/product/1" \
--data-urlencode "screenshots[all]=fullpage" \
--data-urlencode "screenshots[reviews]=.reviews" \
--data-urlencode "screenshot_flags=load_images,block_banners,high_quality" \
--data-urlencode "key=__API_KEY__"
The response JSON will contain result.screenshots with downloadable URLs (append ?key=__API_KEY__ to retrieve them).
Screenshot Flags
load_images– render images (billed by bandwidth).dark_mode– force dark color scheme.block_banners– dismiss cookie banners and overlays.high_quality– skip compression.print_media_format– render as if for print.
Refer to the Screenshot API Getting Started for the full parameter list and billing details.
Considering Alternatives? How AdsCrawl Compares
While Scrapfly delivers a polished, all‑in‑one scraping platform, some teams look for a different pricing model or deeper CDP access. AdsCrawl is one such alternative. It provides real browser capabilities through a unified API: capture screenshots, extract clean HTML and Markdown, and control remote Chrome DevTools Protocol sessions – all built for AI agents, monitoring, and automation workflows. With cloud browser sessions that support fingerprint profiles and concurrent execution, AdsCrawl uses a credit‑based model with a freemium tier so you can test without commitment.
If you need a platform that gives you direct CDP control, allows concurrent browser runs, and exposes usage dashboards for team debugging, AdsCrawl can be a strong complement or alternative to Scrapfly. Read our AdsCrawl tutorial for step‑by‑step examples, and check the Top 10 Browser Automation & Data Extraction API Platforms to see where both tools stand in 2026.
Related reading
- AdsCrawl vs ScrapingBee: Real Browser Power or Just Scraping? - Compare AdsCrawl's real browser sessions, CDP control, and freemium model with ScrapingBee's scraping API. Learn which fits your automation and data extraction needs.
- Playwright Review 2026: A Modern End-to-End Testing Framework Deep Dive - Evidence-based Playwright review for 2026. Explore features, speed, AI agent control, limitations, and how it compares to Selenium and Cypress for modern web testing.
- AdsCrawl vs Selenium vs Playwright: Browser Automation Compared - Compare AdsCrawl, Selenium, and Playwright for browser automation and data extraction. See which tool fits cloud anti-detect scraping, testing, and AI data pipelines.
FAQ
How much does Scrapfly cost?
Scrapfly uses a credit system. You buy a monthly plan or pay‑as‑you‑go credits. Anti‑bot bypass that fails does not consume credits; successful requests are billed according to target complexity. There is a free trial with 1,000 credits, no credit card required.
Can I use Scrapfly for AI agents?
Yes. The AI Browser Agent endpoint provisions stealth Chromium sessions compatible with Browser Use, Stagehand, and Vibium. The MCP Server lets you connect Claude, Cursor, and other MCP clients to scrape, screenshot, and extract data.
How long are screenshot download links valid?
Availability depends on your log retention policy, starting at one week. Check your dashboard settings.
Why do some screenshots look different from a real browser?
Scrapfly’s browsers are optimized for scraping; they may skip image loading by default or render fonts differently. Enable load_images and high_quality flags to approximate a normal browser, but note that visuals can still vary.
Is there an alternative to Scrapfly with similar features?
Yes, AdsCrawl offers comparable cloud browser, screenshot, and extraction APIs with a freemium model and native CDP control. It’s worth exploring if you need more flexibility in browser session management or a different pricing structure.
Conclusion
Scrapfly abstracts away the complexity of modern web scraping: one API key gives you a stealth HTTP client, a headless Chromium over CDP, and a snap‑happy screenshot engine. The examples above get you from zero to functional calls in minutes. Whether you stick with Scrapfly or evaluate alternatives like AdsCrawl, understanding the core patterns – scrape, browser, screenshot – will accelerate your data extraction projects.
