Website screenshots & PDFs in Python

Skip installing Selenium or Playwright and a browser on your server. With requests you get a PNG or PDF back from one call.

1. Get an API key

Click Get free key. You get 100 free renders instantly, no account needed. Store the key in an environment variable called SHOTMINT_KEY.

2. Screenshot a URL

import os, requests

r = requests.get(
    "https://shotmint.creasework.com/v1/screenshot",
    params={"url": "https://example.com", "full_page": "true", "device_scale_factor": 2},
    headers={"X-API-Key": os.environ["SHOTMINT_KEY"]},
    timeout=60,
)
r.raise_for_status()
with open("shot.png", "wb") as f:
    f.write(r.content)
print("credits left:", r.headers.get("X-Credits-Remaining"))

Useful parameters: full_page=true for the whole scrollable page, width/height for the viewport, device_scale_factor=2 for retina, selector to capture a single element, dark_mode=true, and hide_selectors to remove cookie banners. See the full list.

3. Turn HTML into a PDF

html = "<h1>Report</h1><p>Generated by Django</p>"
r = requests.post(
    "https://shotmint.creasework.com/v1/pdf",
    json={"html": html, "format": "Letter", "landscape": True},
    headers={"X-API-Key": os.environ["SHOTMINT_KEY"]},
    timeout=60,
)
open("report.pdf", "wb").write(r.content)

PDF options include format (A4, Letter…), landscape, margin, and print_background. You can pass a url instead of html.

Errors & credits

A failed render never costs a credit. Status 400 means bad input or an unreachable URL, 402 means you're out of credits, and 429/503 mean you should retry with backoff. Every successful response includes an X-Credits-Remaining header.

Notes for Python

In Django or Flask, render a template to a string (render_to_string / render_template) and send that as html. Fonts and CSS load just like in Chrome, so you don't have to deal with WeasyPrint or wkhtmltopdf quirks.

Try it with 100 free renders

No signup, no card. Get a key in one click, then buy credits only if you need more (from €5 for 2,000, never expire).

Get a free API key Full API reference