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.
Click Get free key. You get 25 free renders a month instantly, no account needed. Store the key in an environment variable called SHOTMINT_KEY.
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.
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.
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, and screenshots and PDFs of a URL also carry X-Page-Status: the HTTP status the site answered with. A 403 there usually means you captured the site's bot-protection page, a 404 its error page.
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.
The quickstart above stops at the first error. In production you want three more things: retry only the failures that can fix themselves (503 when the renderer is busy, network timeouts), never retry a 400 or 402, and warn when the site itself answered with an error page. This script does all three for screenshots and PDFs, and prints the credits left after each call:
import { writeFile } from "node:fs/promises";
const API = "https://shotmint.creasework.com";
// Retries only what is worth retrying: 503 (renderer busy) and network timeouts.
// A 400 (bad input, unreachable site) or 402 (no credits) will not fix itself.
async function render(path, params, attempts = 3) {
for (let i = 0; i < attempts; i++) {
let res;
try {
res = await fetch(API + path, {
method: "POST",
headers: { "X-API-Key": process.env.SHOTMINT_KEY, "Content-Type": "application/json" },
body: JSON.stringify(params),
signal: AbortSignal.timeout(90_000),
});
} catch (err) {
if (i === attempts - 1) throw err;
await new Promise(r => setTimeout(r, 2 ** i * 1000));
continue;
}
if (res.ok) {
const page = Number(res.headers.get("x-page-status"));
if (page >= 400) console.warn(`site answered ${page}: you may have captured an error or bot page`);
console.warn("credits left:", res.headers.get("x-credits-remaining"));
return Buffer.from(await res.arrayBuffer());
}
if (res.status !== 503) {
const body = await res.text();
let msg = body;
try { msg = JSON.parse(body).error; } catch {}
throw new Error(`${res.status}: ${msg}`);
}
await new Promise(r => setTimeout(r, 2 ** i * 1000));
}
throw new Error(`renderer still busy after ${attempts} attempts`);
}
await writeFile("shot.png", await render("/v1/screenshot", { url: "https://en.wikipedia.org/wiki/Node.js", full_page: true, format: "png" }));
await writeFile("page.pdf", await render("/v1/pdf", { url: "https://example.com", format: "A4" }));Save it as render.mjs: top-level await only works in ES modules. fetch has no overall timeout by default (undici gives up only when headers take over 300 s), so AbortSignal.timeout(90_000) bounds each attempt. In our run, the full-page Node.js article plus the PDF took 6.5 s together, so 90 s leaves room for slow sites.
Timing, measured on 2026-10-25: a full-page capture of a long Wikipedia article plus an A4 PDF took 8.5 to 25 s end to end, so keep the read timeout well above 30 s. Full-page captures are capped at 16,000 px tall (the Go and PHP articles hit that cap). With a format the API doesn't support, the script stops at once with the API's own message: 400: format must be png, jpeg or webp (got "gif").
The zero-dependency Shotmint Node.js SDK wraps these calls: screenshot() and pdf() return the bytes with the credits left attached, and errors raise with the HTTP status. Install it straight from our domain, no registry account needed.
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). From a script, an AI agent, Make or Zapier, POST /v1/keys/free (no body) returns a key as JSON (openapi.json, no-code recipes).
All guides: guides · integrations · comparisons