DocuStream
HTML to PDF API

Generate PDFs from HTML Templates via REST API

DocuStream renders your HTML with a headless Chromium browser and returns a signed URL to a pixel-perfect PDF — in seconds, at any scale.

How the HTML to PDF API works

1

Create an HTML template

Write your HTML with Handlebars {{variable}} placeholders. Use any CSS you like — DocuStream renders with a headless Chromium browser (Puppeteer), so your design comes out exactly as intended.

2

Upload via the API or dashboard

POST your template to /api/templates. DocuStream auto-detects every {{variable}} and stores the template in your account, ready to accept data.

3

Generate a PDF

POST JSON data to /api/pdfs/generate with your template ID and variable values. DocuStream renders the HTML, injects your data, and returns a signed URL to the finished PDF.

4

Deliver and track

Share the signed URL directly, embed it in an email, or use our /api/emails endpoint to send the document automatically. Every access is logged so you always know who opened what.

Generate a PDF from HTML in one API call

DocuStream's REST API is designed to be simple. Authenticate with an API key, POST your template ID and variables, and receive a signed download URL — no SDK required.

// Generate a PDF from an HTML template
const response = await fetch('https://your-docustream.app/api/pdfs/generate', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'YOUR_API_KEY',
  },
  body: JSON.stringify({
    templateId: 'tmpl_abc123',
    variables: {
      customerName: 'Acme Corp',
      invoiceNumber: 'INV-0042',
      total: '$1,250.00',
    },
  }),
});

const { signedUrl } = await response.json();
// signedUrl → time-limited URL to the generated PDF

Why developers choose DocuStream for HTML to PDF

🎨

Pixel-perfect rendering

Powered by Puppeteer / headless Chromium — the same engine your browser uses. Your CSS layouts, fonts, and images render exactly as designed.

🔀

Handlebars variables

Use {{variable}} placeholders in your HTML. DocuStream auto-detects variables when you save the template and fills them at generation time.

☁️

Signed URLs

Every generated PDF is stored securely and served via time-limited signed URLs, so only authorised recipients can download the file.

📧

Built-in email delivery

Send the generated PDF directly to a recipient in the same API call. DocuStream handles MailerSend delivery and logs every send.

⚡

Bulk generation

Need 500 invoices? POST an array of variable sets and DocuStream generates all PDFs in parallel, returning a signed URL for each.

🔑

Simple API key auth

No OAuth flows or complex setup. Add an X-API-Key header and you're generating PDFs within minutes of signing up.

Start generating PDFs from HTML today

Free plan includes 10 PDFs per month — no credit card required. Upgrade when you're ready to scale.

Get started free