PDF Generation API

Generate clean, paginated PDFs from Markdown, HTML or a URL with a simple REST call. Same engine as the free tools, authenticated with an API key.

1. Get an API key

Sign in and create a key in your cabinet → API tokens. Send it on every request:

Authorization: Bearer <YOUR_API_KEY>

2. Endpoints

MethodPathBody
POST/api/v1/markdown-to-pdf{ markdown, page_size?, title?, file_name? }
POST/api/v1/html-to-pdf{ html, page_size?, title?, file_name? }
POST/api/v1/url-to-pdf{ url, page_size?, file_name? }

All return application/pdf. page_sizea4 | letter | a5 | legal (default a4). A branded footer with page numbers is added to every page.

3. Examples

curl

curl -X POST https://erp2pdf.com/api/v1/markdown-to-pdf \
  -H "Authorization: Bearer $ERP2PDF_KEY" \
  -H "Content-Type: application/json" \
  -d '{"markdown":"# Hello\n\nFrom **Markdown** to PDF.","page_size":"a4"}' \
  --output hello.pdf

Python

import requests

r = requests.post(
    "https://erp2pdf.com/api/v1/markdown-to-pdf",
    headers={"Authorization": f"Bearer {KEY}"},
    json={"markdown": "# Hello\n\nFrom **Markdown** to PDF.", "page_size": "a4"},
)
r.raise_for_status()
open("hello.pdf", "wb").write(r.content)

JavaScript (Node / fetch)

const res = await fetch("https://erp2pdf.com/api/v1/markdown-to-pdf", {
  method: "POST",
  headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ markdown: "# Hello\n\nFrom **Markdown** to PDF.", page_size: "a4" }),
});
const buf = Buffer.from(await res.arrayBuffer());
require("fs").writeFileSync("hello.pdf", buf);

4. Rate limits

Authenticated requests are limited to 1 PDF per minute per account. Exceeding it returns 429 with a Retry-After header. Need higher throughput? Get in touch.

5. Interactive reference

Try the API live below (paste your key via Authorize):