PDF API
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
A4, US Letter or Legal with configurable margins — documents come out printer-ready, not browser-screenshotted.
Backgrounds and brand colors survive the conversion, so invoices and reports keep their look.
Point it at a live page or POST your own HTML template — either way you get back a PDF.
Page numbers, dates and document titles can be layered into the margins automatically.
Generate a thousand invoices in a nightly job or one receipt on demand — same endpoint, same key.
The same input produces the same PDF, which makes diffs, archives and audits painless.
JSON in, rendered file out. Works with anything that can make an HTTP request.
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.pdfconst 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()));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)| Name | Type | Description |
|---|---|---|
| url | string · required | The page to convert. Must start with https:// or http://. |
| paper | string · default A4 | Paper size: A4, Letter or Legal. |
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.
Hyperlinks in the source page are preserved as clickable links in the generated PDF.
One successful PDF response counts as one render, same as screenshots and OG images. Failed renders are free.