API reference

PDFLoom has one endpoint for HTML and URLs. POST JSON to it and the response body is the PDF. There's a machine-readable OpenAPI 3.1 spec for code generators and AI agents, an llms.txt, and an MCP server for AI agents.

Authentication

Create an account to get an API key, then send it in the Authorization header:

Authorization: Bearer plk_...

The X-API-Key: plk_... header also works.

POST /v1/pdf

curl https://pdfloom.dev/v1/pdf \
  -H "Authorization: Bearer $PDFLOOM_KEY" \
  -H "Content-Type: application/json" \
  -d '{"html": "<h1>Invoice #1042</h1><p>Total: $120.00</p>", "format": "A4"}' \
  -o invoice.pdf

Body parameters

NameTypeDescription
htmlstringHTML document to render (max 5 MB). Required unless url is set.
urlstringPublic http(s) URL to render. Required unless html is set.
formatstringA4 (default), Letter, Legal, Tabloid, Ledger, A0–A6.
width / heightstringCustom page size, such as "4in" or "100mm". Overrides format.
landscapebooleanLandscape orientation. Default false.
marginstring | objectOne value for all sides ("20mm") or {"top","right","bottom","left"}.
printBackgroundbooleanPrint background colors and images. Default true.
scalenumberRendering scale, 0.1–2. Default 1.
displayHeaderFooterbooleanEnable headerTemplate and footerTemplate.
headerTemplate / footerTemplatestringHTML for the header and footer. Elements with classes pageNumber, totalPages, date, title and url are filled in. Set a font-size, because the default is tiny.
pageRangesstringPages to include, such as "1-3, 5".
preferCSSPageSizebooleanUse the size from CSS @page rules instead of format.
waitUntilstringload, domcontentloaded, networkidle0 or networkidle2. Default is load for HTML and networkidle2 for URLs.
emulateMediastringprint (default) or screen.

Page numbers in the footer

{
  "html": "...",
  "margin": {"top": "20mm", "bottom": "20mm"},
  "displayHeaderFooter": true,
  "footerTemplate": "<div style='font-size:9px;width:100%;text-align:center'>Page <span class='pageNumber'></span> of <span class='totalPages'></span></div>"
}

Responses

StatusMeaning
200Success. Body is application/pdf. The X-Usage header shows this month's usage and quota.
400Invalid parameters, or the page failed to render. JSON body: {"error": "..."}
401Missing or invalid API key.
429Monthly quota reached. Upgrade or wait for the next month.

POST /v1/invoice

Generates an invoice, receipt, quote or estimate PDF from JSON, with no HTML needed. See the invoice API reference.

GET /v1/usage

Returns {"plan": "free", "used": 12, "quota": 100, "month": "2026-10"}.

MCP server for AI agents

PDFLoom is also an MCP server, so AI assistants and agents (Claude, ChatGPT, Claude Code, Cursor, VS Code, and others) can create PDFs directly. Endpoint: https://pdfloom.dev/mcp (Streamable HTTP).

Connect with your PDFLoom account (no key needed). In apps that support remote MCP connectors with sign-in, such as Claude (Settings → Connectors → Add custom connector) or ChatGPT (Settings → Connectors), add https://pdfloom.dev/mcp. You'll be asked to log in or create a free account and approve the app. It then uses your plan and monthly quota. Disconnect anytime from your dashboard. (OAuth 2.1 with PKCE and dynamic client registration, per the MCP authorization spec.)

Or use an API key in clients that take headers:

Claude Code

claude mcp add --transport http pdfloom https://pdfloom.dev/mcp --header "Authorization: Bearer plk_..."

Cursor (~/.cursor/mcp.json) or any client that takes a JSON config:

{
  "mcpServers": {
    "pdfloom": {
      "url": "https://pdfloom.dev/mcp",
      "headers": {
        "Authorization": "Bearer plk_..."
      }
    }
  }
}

VS Code (.vscode/mcp.json):

{
  "servers": {
    "pdfloom": {
      "type": "http",
      "url": "https://pdfloom.dev/mcp",
      "headers": {
        "Authorization": "Bearer plk_..."
      }
    }
  }
}

Tools

ToolWhat it does
html_to_pdfRenders an HTML document. Takes the same options as POST /v1/pdf.
url_to_pdfRenders a public web page.
create_invoiceBuilds an invoice, receipt, quote, estimate, proforma or tax invoice from line items. Takes the same fields as POST /v1/invoice.
get_usageShows this month's usage and quota.

File storage: MCP tools return a download link instead of the raw PDF, so they don't fill up the agent's context. To make that possible, PDFs created through MCP are stored for 30 minutes under an unguessable URL and then deleted automatically. PDFs from the REST endpoints are never stored. Each successful tool call counts as one PDF.

Tips