Renderwolf is a plain HTTPS API, so Node.js needs no SDK - fetch is enough. A successful render returns the image bytes directly, with no JSON envelope and no base64, so you write the response straight to a file.
Get a key
Create one in the portal. It is shown once and stored hashed, so put it in an environment variable rather than in the file - the samples below read it from one.
Take a screenshot
import { writeFile } from 'node:fs/promises';
const resp = await fetch('https://api.ironfang.uk/renderwolf/v1/screenshot', {
method: 'POST',
headers: {
Authorization: `Bearer ${KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ url: 'https://example.com', width: 1280 }),
});
if (!resp.ok) {
const { error } = await resp.json();
throw new Error(`${error.code}: ${error.message}`);
}
await writeFile('shot.png', Buffer.from(await resp.arrayBuffer()));Handling errors
Success is binary; every error is JSON, shaped as {"error": {"code", "message"}}. A missing or unknown key is 401 invalid_api_key, and a key without the renderwolf:render scope is 403.
// resp.ok is false for 4xx and 5xx. fetch does not throw on them,
// which is the single most common way this goes wrong: without the
// check you write the JSON error body into shot.png and get a file
// that is not an image.PDFs and templates
The same call shape works for /v1/pdf, and for templated images at /v1/image/{id}. Only the path and the body change.
