PDF and PNG rendering API

Generate customer-ready PDFs and images without owning the render stack

SnapHTML renders raw HTML or saved templates in a real browser and returns the finished PDF or PNG as a binary response. Ship invoices, receipts, reports, previews, and share images without running your own rendering workers.

POST /v1/render
await fetch("https://api.snhtml.com/v1/render", {
  method: "POST",
  headers: {
    "authorization": "Bearer sn_live_...",
    "content-type": "application/json"
  },
  body: JSON.stringify({
    html: "<main><h1>Invoice #1842</h1></main>",
    format: "png",
    width: 1024,
    height: 900,
    fullPage: false,
    fileName: "invoice-1842"
  })
});

Built for app-generated files

Send the document once. Control the browser and output in the same request.

Use the HTML you already have

Post your existing markup and styles. No duplicate PDF layout, no separate document builder, no rendering worker to maintain.

Return the format your workflow needs

Generate PDFs for documents and PNGs for previews, invoices, cards, social images, and visual exports from the same API.

Control every render

Set viewport size, full-page capture, media mode, timing, scale, and file names per request.

Keep rendering out of your codebase

Send JSON from your server and get bytes back. No SDK, browser automation, queue tuning, or Playwright cleanup.

Add file generation without adding a rendering stack.

Use SnapHTML from billing systems, CRMs, email pipelines, dashboards, and background jobs. Your app owns the data and markup; SnapHTML handles the browser render and returns a file.

1

Create an API key in the dashboard.

2

Send raw HTML or a saved template with render settings.

3

Store, stream, or attach the returned PDF or PNG.

Request body

Two routes for the two ways teams generate documents.

POST/v1/render

For one-off documents and generated markup

Send HTML directly when your app already builds the full document for each request.

POST/v1/render/template

For reusable customer-facing documents

Save the HTML once, then send a template ID and variables when each customer needs a file.

html/v1/renderstringRequiredComplete HTML document to render.
templateId/v1/render/templatestringRequiredID of the saved template to render.
variables/v1/render/templateRecord<string, string | number | boolean | null>OptionalValues injected into {{variables}} before rendering.
formatBoth"png" | "pdf"OptionalOutput format. Defaults to png.
widthBothnumberOptionalViewport width in pixels. Defaults to 1024.
heightBothnumberOptionalViewport height in pixels. Defaults to 768.
fullPageBothbooleanOptionalCapture the full page for PNG output.
deviceScaleFactorBothnumberOptionalViewport scale factor from 1 to 4.
waitUntilBoth"load" | "domcontentloaded" | "networkidle"OptionalPage load state before rendering.
waitForTimeoutBothnumberOptionalExtra wait in milliseconds before capture.
mediaBoth"screen" | "print"OptionalCSS media mode used during render.
reducedMotionBoth"reduce" | "no-preference"OptionalMotion preference used by the browser.
transparentBackgroundBothbooleanOptionalUse a transparent PNG background.
omitBackgroundBothbooleanOptionalAlias for transparent PNG background.
printBackgroundBothbooleanOptionalInclude CSS backgrounds in PDF output.
marginBothobjectOptionalPDF margins with top, right, bottom, and left strings.
scaleBothnumberOptionalPDF scale from 0.1 to 2.
pdfFormatBothstringOptionalPDF paper format such as A4 or Letter.
preferCSSPageSizeBothbooleanOptionalUse CSS @page size for PDF output.
fileNameBothstringOptionalAttachment filename without extension.

Pricing

Start free. Upgrade when generated files become part of your product.

Free

Free

Test real files before you pay.

  • 100 renders / month
  • No credit card required
  • PNG and PDF output
  • Direct binary response

Builder

$9/mo

For products that generate customer files every day.

  • 2,000 renders / month
  • PNG and PDF output
  • Direct binary response

Pro

$29/mo

For growing render volume and background jobs.

  • 10,000 renders / month
  • PNG and PDF output
  • Direct binary response

Max

$99/mo

For high-volume document and image generation.

  • 50,000 renders / month
  • PNG and PDF output
  • Direct binary response

Get started

Stop maintaining render workers. Ship the file.

Create a free account, generate an API key, and test a real PDF or PNG from raw HTML or a saved template in the dashboard sandbox.

Try for free