Website screenshot API

PNG or JPEG of any URL. Fast where it can be, stealthy where it has to be.

POST /v1/scrape/screenshot 15 / 25 / 35 credits Utilities

Choose viewport (default 1280 x 720) or capture the entire scrollable page height. Pick PNG for lossless or JPEG with quality control for half the size. Sites that block normal headless browsers (anti-bot challenges, fingerprint walls) are automatically retried through our stealth engine: same endpoint, same response shape, you don't have to know which engine ran.

The hard part

Running a headless browser in production is its own job: keeping the browser up, refreshing fingerprints, recovering from bot challenges, capturing the screenshot at exactly the right moment of the page lifecycle. And then doing it again on the next site that blocks your fingerprint. You ask for an image and get one. We handle which engine, which proxy, and how long to wait.

Screenshot API: what you get

  • Viewport capture in ~2–3 s; full-page in ~2–4 s on typical sites.
  • Hostile sites (heavy anti-bot) auto-fall-back to stealth in ~8–12 s.
  • PNG or JPEG with 1–100 quality; JPEG is roughly half the byte size at q=70+.
  • Full-page mode auto-detects scrollable height up to the rendered page.
  • Base64 returned inline (no S3 round-trip, no presigned-URL dance).
  • Failures and timeouts don't bill.
  • cookies, headers, render, selector, session_id, and include_usage supported: screenshot authenticated pages, target a single element, or reuse a sticky exit IP.

Screenshot API use cases

  • Visual monitoring

    Capture a page on a schedule and compare the images to catch layout or content changes.

  • Link previews and thumbnails

    A 1280 × 720 viewport capture makes a preview card; JPEG keeps it small.

  • Evidence and archiving

    Full-page captures record what a page showed, with final_url and status_code alongside.

  • Element shots

    selector crops the image to one element, such as a chart or a product card.

Screenshot API quickstart: Python, Node and curl

Install the SDK with pip install scrapenest (PyPI) or npm install scrapenest (npm), or send the raw HTTP call with your key in the Authorization: Bearer header. No key yet? Sign up free, verify your email, then create a key in your dashboard.

import os
from scrapenest import Client

client = Client(os.environ["SCRAPENEST_API_KEY"], timeout=120)
shot = client.screenshot("https://news.ycombinator.com", viewport_width=1280, viewport_height=720, format="png")
shot.save("screenshot.png")
print(shot.width, shot.height, shot.method, shot.credits_charged, "credits")

Screenshot API request and response

Request body

{
  "url": "https://news.ycombinator.com",
  "viewport_width": 1280,
  "viewport_height": 720,
  "full_page": false,
  "format": "png",
  "wait_extra_ms": 0
}

Response JSON

{
  "url": "https://news.ycombinator.com",
  "final_url": "https://news.ycombinator.com/",
  "status_code": 200,
  "method": "browser",
  "escalated": false,
  "elapsed_ms": 2470,
  "width": 1280,
  "height": 720,
  "bytes": 159284,
  "format": "png",
  "image_base64": "iVBORw0KGgoAAAANSUhEUgAA…",
  "cache_hit": false,
  "credits_charged": 15,
  "proxy_used": null
}

Fields with no value are left out of the JSON rather than sent as null, so read optional fields defensively. proxy_used is the exception: it is always present, null included.

Screenshot API pricing

15 credits for a viewport capture, 25 credits for full-page, 35 credits when the target site only renders through our stealth backend. A selector-targeted capture bills 15 (or 35 if the site forces our stealth backend, which doesn't crop to the selector), even with full_page=true. A selector that matches nothing returns the full viewport at the requested tier and price. Cache hits bill at 1 credit. Failures don't bill.

  • Set wait_extra_ms for sites with late-loading content (SPAs that fade in after window.load, lazy-loaded images, charts that mount on idle).
  • Hostile sites trigger our stealth backend automatically. You'll see "method": "stealth" and "escalated": true in the response and the 35-credit charge, no flag to flip.
  • Full-page captures of long pages (1080+ rows of content) can produce 1 MB+ PNGs. JPEG with quality 75–85 typically halves that.

Plans and pay-as-you-go rates are on the pricing page.

Screenshot API limits

  • Viewport: 320 to 3840 wide and 240 to 2160 tall, default 1280 × 720. device_scale_factor: 1 to 3, billed the same.
  • jpeg_quality: 1 to 100, default 85. wait_extra_ms: up to 10,000.
  • One capture gets 75 seconds across every tier it tries. Past 20 seconds the response streams, so a later error arrives inside the 200 body.
  • Caching is off unless you set cache_ttl_seconds. Requests with cookies, headers or session_id are never cached.
  • cookies: up to 50. headers: up to 30. selector: up to 300 characters.

Screenshot API error codes

HTTPCodeMeaning
422selector_not_foundA selector was set and no image could be rendered at all. A selector that only matches nothing returns the full viewport with selector_applied: false.
422target_errorThe target returned an HTTP error status, or its host doesn't resolve in DNS.
503screenshot_failedThe capture failed or ran past 75 seconds. Not billed.
503connection_failedThe DNS lookup failed temporarily. Retry with backoff.
400unsafe_urlThe URL is malformed or points at a private host.
400redirect_to_unsafe_urlThe page redirected to a private address.

Every endpoint can also return 401 unauthorized (missing or wrong key), 402 insufficient_credits (balance used up), 403 email_not_verified (an email signup must verify its address before its key works) and 429 rate_limited or concurrency_limit_exceeded. All errors share one JSON envelope; see the error reference.

questions

Screenshot API FAQ

How do I take a full-page screenshot?

Set full_page: true. The capture covers the page's whole scrollable height and bills 25 credits instead of the 15 for a viewport capture.

What happens on sites that block headless browsers?

With render at auto (the default) or browser, a capture refused by anti-bot is retried in stealth mode automatically. The response then shows method: "stealth" and escalated: true and bills 35 credits. If you already know a site is hostile, render: "stealth" skips the first attempt.

Can I screenshot a page behind a login?

Yes. Send cookies (a name-to-value map or a list of {name, value} objects) and headers, and reuse the session_id of your scraping calls to keep the same exit IP for about 10 minutes.

PNG or JPEG?

PNG is lossless and the default. JPEG with jpeg_quality between 75 and 85 is typically about half the size, which matters for full-page captures of long pages.

Page updated