Turn raw HTML code into a PNG, JPEG, or WebP image. Perfect for generating email templates, invoices, and social cards.
# Capture HTML hosted locally (use ngrok or similar for localhost)
curl "https://snapapi.tech/v1/screenshot?url=https://your-html-host.com/invoice.html&api_key=YOUR_KEY&selector=%23invoice&format=png" -o invoice.pngimport requests
# Capture a specific element from your HTML page
response = requests.get("https://snapapi.tech/v1/screenshot", params={
"url": "https://your-html-host.com/invoice.html",
"api_key": "YOUR_KEY",
"selector": "#invoice",
"format": "png"
})
with open("invoice.png", "wb") as f:
f.write(response.content)const res = await fetch(
"https://snapapi.tech/v1/screenshot?" + new URLSearchParams({
url: "https://your-html-host.com/invoice.html",
api_key: "YOUR_KEY",
selector: "#invoice",
format: "png"
})
);
require("fs").writeFileSync("invoice.png", Buffer.from(await res.arrayBuffer()));