Screenshot API for Python
Capture website screenshots in Python without Selenium, Playwright, or any browser. One HTTP request with the requests library.
Why use an API instead of Selenium?
❌ Selenium / Playwright
- Chrome/Firefox binary required
- Breaks on OS updates, driver mismatches
- Slow: launch browser, navigate, wait, capture
- Memory-intensive, unreliable in Docker
- No device frames or popup removal
✅ GrabShot API
- Just
pip install requests - Works on any OS, serverless, Docker
- Fast: ~2s per screenshot, no browser overhead
- Consistent results, auto-retries
- Device frames, AI cleanup, full-page capture
Quick Start
import requests
response = requests.get("https://grabshot.dev/v1/screenshot", params={
"url": "https://stripe.com",
"format": "png",
"width": "1280",
"frame": "macbook",
"key": "YOUR_API_KEY",
})
with open("screenshot.png", "wb") as f:
f.write(response.content)
print("Saved screenshot.png")
Flask — Dynamic OG Images
from flask import Flask, request, Response
import requests as http
app = Flask(__name__)
@app.route("/og/<path:page>")
def og_image(page):
r = http.get("https://grabshot.dev/v1/screenshot", params={
"url": f"https://mysite.com/{page}",
"width": "1200",
"height": "630",
"format": "png",
"key": API_KEY,
})
return Response(r.content, mimetype="image/png",
headers={"Cache-Control": "public, max-age=86400"})
FastAPI — Async Screenshot Service
import httpx
from fastapi import FastAPI
from fastapi.responses import Response
app = FastAPI()
@app.get("/screenshot")
async def screenshot(url: str):
async with httpx.AsyncClient() as client:
r = await client.get("https://grabshot.dev/v1/screenshot", params={
"url": url, "format": "png", "key": API_KEY
})
return Response(content=r.content, media_type="image/png")
Batch Screenshots
import requests
from concurrent.futures import ThreadPoolExecutor
urls = ["https://github.com", "https://stripe.com", "https://vercel.com"]
def capture(url):
slug = url.split("/")[2]
r = requests.get("https://grabshot.dev/v1/screenshot",
params={"url": url, "format": "png", "key": API_KEY})
with open(f"{slug}.png", "wb") as f:
f.write(r.content)
return slug
with ThreadPoolExecutor(max_workers=3) as pool:
results = list(pool.map(capture, urls))
print(f"Captured: {results}")
Start capturing screenshots in Python
25 free screenshots per month. No credit card required.
Get Free API Key →