Screenshot API for Python

Capture screenshots, PDFs and OG images from Python with the official SDK or plain requests.

There is an official Python SDK on PyPI (getsnap). It wraps the same REST endpoint and returns the parsed JSON, so you can drop down to requests at any point without changing anything server-side.

Install

pip install getsnap

Your first screenshot in Python

One POST, one JSON body, one URL back. The response is a CDN link to the finished image.

Python SDK

from getsnap import GetSnap

snap = GetSnap("sk_live_YOUR_KEY")

result = snap.screenshot(url="https://github.com", format="png")
print(result["url"])   # CDN URL to your screenshot

requests (no SDK)

import requests

resp = requests.post(
    "https://api.getsnap.dev/v1/screenshot",
    headers={"X-API-Key": "sk_live_YOUR_KEY"},
    json={"url": "https://github.com", "format": "png"},
    timeout=60,
)
resp.raise_for_status()
print(resp.json()["url"])

Full-page captures and other options

Every option is a field in the same JSON body. The common ones are full-page capture, popup and ad removal, viewport size, and lazy-load scrolling.

result = snap.screenshot(
    url="https://example.com",
    format="png",
    full_page=True,       # capture past the fold
    remove_popups=True,   # dismiss cookie banners and modals
    block_ads=True,
    lazy_load=True,       # auto-scroll so lazy images load
    extract_text=True,    # also return the page text
)
print(result["url"])
print(result["extracted_text"])

Saving the image to disk

By default you get a CDN URL. Ask for a binary response instead and you get the bytes directly, which saves a round-trip when you are storing the file yourself.

# Skip the CDN round-trip and get the bytes directly
data = snap.screenshot_binary(url="https://example.com", format="webp", quality=90)
with open("screenshot.webp", "wb") as f:
    f.write(data)

Handling errors

Every failure returns JSON with an error code and a human-readable message. These are the ones worth branching on:

StatuserrorWhat it means
400validation_errorA field is missing or out of range. The body names the field.
401unauthorizedMissing or unknown API key.
402quota_exceededMonthly capture limit reached.
429rate_limit_exceededToo many requests this minute. Back off and retry.
500capture_failedThe page could not be rendered - usually a timeout on a page that never settles.
import requests

try:
    resp = requests.post(
        "https://api.getsnap.dev/v1/screenshot",
        headers={"X-API-Key": "sk_live_YOUR_KEY"},
        json={"url": "https://example.com"},
        timeout=60,
    )
    resp.raise_for_status()
    print(resp.json()["url"])
except requests.HTTPError as e:
    body = e.response.json()
    # e.g. {"error": "quota_exceeded", "message": "..."}
    print(e.response.status_code, body.get("error"), body.get("message"))

Rate limits and quotas

PlanCaptures / monthRequests / minute
Free1005
Starter5,00030
Pro25,00060
Business100,000120

Exceeding the per-minute limit returns 429; exceeding the monthly quota returns 402. See pricing for the full breakdown.

Frequently asked questions

Is there an official Python SDK for taking screenshots?

Yes. There is an official Python SDK that wraps the REST API and returns parsed results. It is optional - the API is a single JSON POST, so a plain HTTP client works identically.

Do I need to run or manage a headless browser?

No. getSnap.dev runs Chromium server-side and returns a finished image, PDF or video. You never install Playwright or Puppeteer, and you never maintain a browser pool.

Is there a free tier?

Yes - 100 captures a month at 5 requests a minute, with no credit card required. Paid plans start at $9/month for 5,000 captures at 30 requests a minute.

How do I capture a page that requires login from Python?

Pass your own cookies or HTTP headers in the request body and the capture runs authenticated. Use a dedicated least-privilege account rather than your own session.

Next steps

Related reading

Start capturing from Python

100 screenshots a month on the free tier. No credit card required.

Get Free API Key