Website screenshots & PDFs in Node.js

No need to install and babysit headless Chrome in your Node app. Call one HTTP endpoint with the built-in fetch (Node 18+) and get back image or PDF bytes.

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 { writeFile } from "node:fs/promises";

const params = new URLSearchParams({ url: "https://example.com", full_page: "true" });
const res = await fetch("https://shotmint.creasework.com/v1/screenshot?" + params, {
  headers: { "X-API-Key": process.env.SHOTMINT_KEY },
});
if (!res.ok) throw new Error(`Render failed: ${res.status} ${await res.text()}`);
await writeFile("shot.png", Buffer.from(await res.arrayBuffer()));
console.log("credits left:", res.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

const res = await fetch("https://shotmint.creasework.com/v1/pdf", {
  method: "POST",
  headers: { "X-API-Key": process.env.SHOTMINT_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({ html: "<h1>Invoice #42</h1><p>Total: €120</p>", format: "A4", margin: "15mm" }),
});
await writeFile("invoice.pdf", Buffer.from(await res.arrayBuffer()));

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 Node.js

In Express you can stream the result straight to the client: res.type("png").send(Buffer.from(await r.arrayBuffer())). That keeps Chromium (~300MB) out of your Docker image and your serverless bundle.

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