Screenshot API in Python

Capture any URL as a PNG, JPEG, WebP, or PDF from your Python app in three lines of code. No Selenium WebDriver to maintain, no Playwright install, no Chromium binary in your Docker image.

100 free screenshots/month · Works with requests, httpx, Django, FastAPI, Flask, AWS Lambda

The 3-line version (requests)

import requests r = requests.get( 'https://api.aisnapapi.com/v1/screenshot', params={'url': 'https://example.com'}, headers={'Authorization': 'Bearer YOUR_API_KEY'} ) open('shot.png', 'wb').write(r.content)

The response body is raw image bytes. No JSON, no base64.

Async with httpx

import httpx, asyncio async def snap(url): async with httpx.AsyncClient() as c: r = await c.get( 'https://api.aisnapapi.com/v1/screenshot', params={'url': url, 'full_page': 'true'}, headers={'Authorization': 'Bearer YOUR_API_KEY'} ) return r.content png = asyncio.run(snap('https://news.ycombinator.com'))

Django view: proxy a screenshot to the user

import os, requests from django.http import HttpResponse def screenshot(request): target = request.GET.get('url') r = requests.get( 'https://api.aisnapapi.com/v1/screenshot', params={'url': target}, headers={'Authorization': f'Bearer {os.environ["SNAPAPI_KEY"]}'}, stream=True ) return HttpResponse(r.iter_content(8192), content_type='image/png')

FastAPI endpoint that returns a screenshot

import os, httpx from fastapi import FastAPI from fastapi.responses import StreamingResponse app = FastAPI() @app.get('/screenshot') async def capture(url: str): client = httpx.AsyncClient() r = await client.get( 'https://api.aisnapapi.com/v1/screenshot', params={'url': url, 'width': 1280}, headers={'Authorization': f'Bearer {os.environ["SNAPAPI_KEY"]}'} ) return StreamingResponse(iter([r.content]), media_type='image/png')

Generate a PDF from any URL

import requests r = requests.get( 'https://api.aisnapapi.com/v1/screenshot', params={'url': 'https://en.wikipedia.org/wiki/Python_(programming_language)', 'format': 'pdf'}, headers={'Authorization': 'Bearer YOUR_API_KEY'} ) open('page.pdf', 'wb').write(r.content)

Common gotchas

Start with 100 free screenshots / month

No credit card. No upsell wall. 30-second signup.

Get My Free API Key