Documentation
RelayPDF API docs
Use this hub to pick the right RelayPDF surface: generate a PDF from HTML, Markdown, a URL, or a published template; screenshot a page; convert Office files; or run PDF tools (merge, protect, stamp, forms). REST, SDKs, and CLI share a bearer key. Hosted MCP uses Clerk login or that same key. Agents should run relaypdf setup and wait for browser approval instead of asking for a pasted key.
Everything is a POST to https://api.relaypdf.com with a bearer key. The same key covers PDFs, screenshots, converts, and the PDF tools.
Guides
Quickstart
1. Get a key
# device flow — approve once in the browser
$ npx @relaypdf/cli setup
# writes RELAYPDF_API_KEY to your env file with mode 06002. Make your first PDF
curl -X POST https://api.relaypdf.com/v1/pdf \
-H "Authorization: Bearer pdf_live_…" \
-H "Content-Type: application/json" \
-d '{
"html": "<h1>Invoice #1042</h1><p>Total: $1,200.00</p>",
"filename": "invoice.pdf"
}' \
--output invoice.pdfimport { RelayPDF } from "@relaypdf/sdk";
const client = new RelayPDF({ apiKey: process.env.RELAYPDF_API_KEY });
const pdf = await client.pdf.fromHtml(
"<h1>Invoice #1042</h1><p>Total: $1,200.00</p>",
{ filename: "invoice.pdf" },
);
await pdf.save("invoice.pdf");import os
from relaypdf import RelayPDF
client = RelayPDF(api_key=os.environ["RELAYPDF_API_KEY"])
pdf = client.pdf.from_html(
"<h1>Invoice #1042</h1><p>Total: $1,200.00</p>",
filename="invoice.pdf",
)
pdf.save("invoice.pdf")Official SDKs: npm i @relaypdf/sdk, pip install relaypdf, Composer, NuGet, and Maven. JSON field names match REST. Full surface: Node.js SDK and Python, PHP, C#, Java.
Endpoint reference
All write endpoints require a bearer key and a JSON body. Every generating endpoint also accepts response: "binary" | "url" | "async".
Errors are structured JSON
Every failure returns { "error": { "code", "message" } }. Failed requests are never billed. Full table: Errors.