Introduction
pdfRelay converts HTML to pixel-perfect PDFs via a simple REST API. Send HTML, a URL, or a React template — get back a PDF in milliseconds.
How it works
- 1Create an API key in the dashboard. Use
sk_test_keys for development. - 2Send a POST request to
/v1/convertwith your HTML content. - 3Get back a PDF — either as a download URL (JSON) or raw bytes (
Accept: application/pdf).
Quick start
cURL
curl -X POST https://api.pdfrelay.com/v1/convert \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{"source": "html", "content": "<h1>Hello!</h1>"}'JavaScript
const res = await fetch("https://api.pdfrelay.com/v1/convert", {
method: "POST",
headers: {
"Authorization": "Bearer sk_test_...",
"Content-Type": "application/json",
},
body: JSON.stringify({
source: "html",
content: "<h1>Hello!</h1>",
}),
});
const { download_url } = await res.json();Python
import requests
res = requests.post("https://api.pdfrelay.com/v1/convert",
headers={"Authorization": "Bearer sk_test_..."},
json={"source": "html", "content": "<h1>Hello!</h1>"})
print(res.json()["download_url"])Response:
200 OK
{
"id": "conv_kP3xNqWm",
"status": "completed",
"document_id": "doc_8c2ef1a3",
"download_url": "https://...",
"page_count": 1,
"duration_ms": 29
}Base URL
https://api.pdfrelay.com/v1
Rendering engines
pdfRelay uses a native Rust engine by default (29ms avg). Puppeteer/Chromium is used as a fallback for features that require a browser.
| Feature | Rust | Puppeteer |
|---|---|---|
| HTML → PDF | ✓ | ✓ |
| Page size & margins | ✓ | ✓ |
| Tagged PDF / PDF/A | ✓ | — |
| JavaScript execution | — | ✓ |
| Headers & footers | — | ✓ |
| URL rendering | — | ✓ |
| Avg speed | 29 ms | 1,109 ms |
Override with "engine": "puppeteer" in the request body. Auto-fallback happens when javascript, header_html, or footer_html is set.