Appearance
Quick start with Node.js
Learn how to send your first request using Node.js.
This guide shows how to integrate Doppio's API into your Node.js application to generate PDFs or screenshots.
❶ Prerequisites
To get the most out of this guide, you’ll need to sign up for Doppio.
Go to the dashboard and copy the API key of your organization, under API key. Every member of the organization uses the same key, and each render made with it counts in the quota of the organization. The free plan is free forever.


❷ Send a request
The examples on this page use import and top-level await: run them with Node.js 22+, or save them as .mjs files on Node.js 18 and 20.
Option A — Official Node.js SDK (doppio-nodejs)
Install the zero-dependency SDK:
sh
npm install doppio-nodejsjs
import { writeFile } from 'node:fs/promises';
import { Doppio } from 'doppio-nodejs';
const client = new Doppio(process.env.DOPPIO_API_KEY);
// Sync render: returns { documentUrl, doppioRequestId, renderStatus, ... }
const result = await client.renderPdfSync({
pdf: { printBackground: true },
goto: {
url: 'https://example.doppio.sh/information-booklet.html',
options: { waitUntil: ['networkidle0'] },
},
});
console.log(result.documentUrl);
// Direct render: returns the PDF as an ArrayBuffer
const buffer = await client.renderPdfDirect({
pdf: { printBackground: true },
goto: {
url: 'https://example.doppio.sh/information-booklet.html',
options: { waitUntil: ['networkidle0'] },
},
});
await writeFile('output.pdf', Buffer.from(buffer));Option B — Native fetch (no dependencies)
Render PDF
js
const response = await fetch('https://api.doppio.sh/v1/render/pdf/sync', {
method: 'POST',
headers: {
Authorization: 'Bearer <YOUR API KEY>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
page: {
pdf: {
printBackground: true,
},
goto: {
url: 'https://example.doppio.sh/information-booklet.html',
options: {
waitUntil: ['networkidle0'],
},
},
},
}),
});
if (!response.ok) {
throw new Error(`Doppio error ${response.status}: ${await response.text()}`);
}
const data = await response.json();
console.log(data.documentUrl);Direct method
The direct method returns the PDF itself in the response, which is useful when the client should download the file immediately.
Synchronous method
The synchronous method returns a JSON payload containing fields such as documentUrl. This is useful if your application needs to store the hosted URL or process it further.
That's it.
The Asynchronous Approach
If your project needs webhook-based response handling, take a look at our asynchronous method.
It is a good fit when document generation should run in the background, especially for large batches, automated workflows, or flows where the user should not wait for the render to finish.
Need more?
Are you looking for a specific framework? Check out our quick starts by category.