DocPress

API reference

One endpoint. JSON in, PDF out. Authenticate with Authorization: Bearer dp_…. Get a key.

POST /v1/pdf

FieldTypeNotes
htmlstringHTML document or fragment. External URLs are never fetched; use data: URIs.
markdownstringMarkdown (tables, fenced code, footnotes, admonitions). Used when html is absent.
themestringclean (default), report, minimal, letter, or none for your own CSS only (HTML input; Markdown with none falls back to minimal).
cssstringExtra CSS appended after the theme. Supports @page rules.
page_sizestringA4, Letter, Legal, A5.
title, author, datestringUsed on the cover and in metadata.
cover, toc, page_numbersboolCover page; table of contents (Markdown only); page numbers (default true).
footer, headerstringPer-page footer text (bottom-left) and running header (top-right).
filenamestringContent-Disposition filename (default document.pdf).
templatestringHosted template name: invoice, certificate, report. Use with data instead of html/markdown. Fields and samples.
dataobjectJSON 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

OpenAPI: /v1/openapi.json