PDF and image rendering API

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

SnapHTML renders raw HTML, URLs, or saved templates in a real browser and returns the finished PDF, PNG, WebP, or JPG 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 page source you already have

Post existing markup and styles or send a URL. No duplicate PDF layout, no separate document builder, no rendering worker to maintain.

Return the format your workflow needs

Generate PDFs for documents and PNG, WebP, or JPG images for previews, invoices, cards, social images, and visual exports from the same API.

Control every render

Set viewport size, image quality, 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, page, or markup; SnapHTML handles the browser render and returns a file.

1

Create an API key in the dashboard.

2

Send raw HTML, a URL, or a saved template with render settings.

3

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

Request body

Two routes for the two ways teams generate documents.

POST/v1/render

For one-off documents, URLs, and generated markup

Send HTML directly when your app builds the document, or send a URL when the page already exists.

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/renderstringOptionalComplete HTML document to render. Required when url is not provided.
url/v1/renderstringOptionalURL to render. Required when html is not provided.
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" | "webp" | "jpg"OptionalOutput format. Defaults to png.
qualityBothnumberOptionalJPG and WebP quality from 1 to 100. Defaults to 100.
widthBothnumberOptionalViewport width in pixels. Defaults to 1024.
heightBothnumberOptionalViewport height in pixels. Defaults to 768.
fullPageBothbooleanOptionalCapture the full page for image output.
deviceScaleFactorBothnumberOptionalViewport scale factor from 1 to 4. Defaults to 2 for sharper image output on high-DPI screens.
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 or WebP background.
omitBackgroundBothbooleanOptionalAlias for transparent PNG or WebP 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
  • PDF and image output
  • Direct binary response

Builder

$9/mo

For products that generate customer files every day.

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

Pro

$29/mo

For growing render volume and background jobs.

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

Max

$99/mo

For high-volume document and image generation.

  • 50,000 renders / month
  • PDF and image 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, PNG, WebP, or JPG from raw HTML, a URL, or a saved template in the dashboard sandbox.

Try for free