PDF API

HTML and URLs to print-ready PDFs.

Convert any web page or HTML document into a real PDF with proper page sizes, margins and backgrounds. Invoices, reports and tickets — without a print stylesheet in sight.

POST https://api.ottersnap.com/v1/pdf

Real page sizes

A4, US Letter or Legal with configurable margins — documents come out printer-ready, not browser-screenshotted.

Print backgrounds

Backgrounds and brand colors survive the conversion, so invoices and reports keep their look.

From URL or raw HTML

Point it at a live page or POST your own HTML template — either way you get back a PDF.

Headers & footers

Page numbers, dates and document titles can be layered into the margins automatically.

Batch-friendly

Generate a thousand invoices in a nightly job or one receipt on demand — same endpoint, same key.

Deterministic output

The same input produces the same PDF, which makes diffs, archives and audits painless.

Call it in seconds

JSON in, rendered file out. Works with anything that can make an HTTP request.

CURL
curl -X POST https://api.ottersnap.com/v1/pdf \
  -H "Authorization: Bearer otter_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/invoice/1042", "paper": "A4"}' \
  --output invoice.pdf
NODE.JS
const res = await fetch("https://api.ottersnap.com/v1/pdf", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.OTTERSNAP_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ url: "https://example.com/invoice/1042", paper: "A4" }),
});

fs.writeFileSync("invoice.pdf", Buffer.from(await res.arrayBuffer()));
PYTHON
import os, requests

res = requests.post(
    "https://api.ottersnap.com/v1/pdf",
    headers={"Authorization": f"Bearer {os.environ['OTTERSNAP_KEY']}"},
    json={"url": "https://example.com/invoice/1042", "paper": "A4"},
)

open("invoice.pdf", "wb").write(res.content)

Parameters

NameTypeDescription
urlstring · requiredThe page to convert. Must start with https:// or http://.
paperstring · default A4Paper size: A4, Letter or Legal.

Questions about the pdf api

Can I send raw HTML instead of a URL?

Yes — pass your HTML in the request body and OtterSnap renders it exactly like a page. This is the recommended path for invoices built from templates.

Do links stay clickable in the PDF?

Hyperlinks in the source page are preserved as clickable links in the generated PDF.

How are PDFs counted in my quota?

One successful PDF response counts as one render, same as screenshots and OG images. Failed renders are free.

Ready to render?

Free tier, no credit card. Upgrade only when you scale.

Get your API key