API reference
One endpoint. JSON in, PDF out. Authenticate with Authorization: Bearer dp_…. Get a key.
POST /v1/pdf
| Field | Type | Notes |
|---|---|---|
html | string | HTML document or fragment. External URLs are never fetched; use data: URIs. |
markdown | string | Markdown (tables, fenced code, footnotes, admonitions). Used when html is absent. |
theme | string | clean (default), report, minimal, letter, or none for your own CSS only (HTML input; Markdown with none falls back to minimal). |
css | string | Extra CSS appended after the theme. Supports @page rules. |
page_size | string | A4, Letter, Legal, A5. |
title, author, date | string | Used on the cover and in metadata. |
cover, toc, page_numbers | bool | Cover page; table of contents (Markdown only); page numbers (default true). |
footer, header | string | Per-page footer text (bottom-left) and running header (top-right). |
filename | string | Content-Disposition filename (default document.pdf). |
template | string | Hosted template name: invoice, certificate, report. Use with data instead of html/markdown. Fields and samples. |
data | object | JSON data for the template. Logos as data:image/… URIs. |
Response
200 with application/pdf body and headers X-Pages, X-Quota-Used, X-Quota-Limit. Errors are JSON: 400 no source given, 401 bad key, 413 too large, 422 render or validation error (detail is a string for render errors, or a list of {loc, msg, type} for invalid fields), 429 quota reached.
Examples
# Python
import requests
r = requests.post("https://docpress.dev/v1/pdf", headers={"Authorization": "Bearer dp_..."},
json={"html": "<h1>Receipt</h1><p>Thanks!</p>", "theme": "minimal", "page_size": "Letter"})
open("receipt.pdf", "wb").write(r.content)
// Node
const res = await fetch("https://docpress.dev/v1/pdf", { method: "POST",
headers: { Authorization: "Bearer dp_...", "Content-Type": "application/json" },
body: JSON.stringify({ markdown: "# Report\n\nHello", theme: "report", cover: true, toc: true }) });
require("fs").writeFileSync("report.pdf", Buffer.from(await res.arrayBuffer()));
GET /v1/me
Returns plan, quota and usage for the key.
Limits and behaviour
- 2 MB source, 300 pages per document. Renders are processed two at a time server-wide; extra requests wait briefly.
- Free plan output carries a small footer mark. Paid plans don't.
- Fonts available: DejaVu, Liberation, Noto, Carlito, Caladea. Embed others with
@font-facedata: URIs. - Rendering engine: CSS paged media (WeasyPrint). No JavaScript execution.
OpenAPI: /v1/openapi.json