# PDFLoom
> HTML/URL to PDF API rendered by headless Chrome, plus a JSON-to-invoice PDF endpoint. Base URL: https://pdfloom.dev. Auth: `Authorization: Bearer plk_...` (or `X-API-Key`). Free plan: 100 PDFs/month. REST API documents are rendered in memory and not stored.
## API
- [OpenAPI spec](https://pdfloom.dev/openapi.json): machine-readable reference for all endpoints
- [API reference](https://pdfloom.dev/docs): POST /v1/pdf (HTML or URL → PDF), GET /v1/usage
- [Invoice API](https://pdfloom.dev/invoice-api): POST /v1/invoice (JSON line items → invoice, receipt, quote, estimate or proforma PDF)
## Quick reference
- `POST /v1/pdf` JSON body: `html` or `url` (one required); optional `format` (A4 default, Letter, Legal…), `landscape`, `margin` ("20mm" or {top,right,bottom,left}), `printBackground` (default true), `scale`, `displayHeaderFooter` + `headerTemplate`/`footerTemplate` (classes pageNumber, totalPages), `pageRanges`, `preferCSSPageSize`, `waitUntil`, `emulateMedia`. Response: application/pdf.
- `POST /v1/invoice` JSON body: `items` [{desc, qty, price}] (required); optional `docType` (invoice|receipt|quote|estimate|proforma|tax), `language` (en|sv|da|nb|fi|de|nl|fr|es|it), `number`, `currency`, `date`, `due`, `from`, `to`, `tax` (%), `discount`, `shipping`, `notes`, `logo`, `accentColor`, `taxLabel`. Response: application/pdf.
- Errors: JSON `{"error": "..."}` with 400 (bad input/render failure), 401 (bad key), 429 (quota or rate limit), 503 (busy, retry).
- Get a key: https://pdfloom.dev/signup
## MCP server (for AI agents)
- Endpoint: https://pdfloom.dev/mcp (Streamable HTTP, stateless). Sign in with OAuth (apps like Claude/ChatGPT: add it as a custom connector and log in), or send `Authorization: Bearer plk_...`
- Claude Code: `claude mcp add --transport http pdfloom https://pdfloom.dev/mcp --header "Authorization: Bearer plk_..."`
- Tools: html_to_pdf, url_to_pdf, create_invoice, get_usage. They return a download link that expires after 30 minutes (files are deleted then).
- [Setup for Cursor and VS Code](https://pdfloom.dev/docs#mcp)
## Guides
- [HTML to PDF in Node.js](https://pdfloom.dev/guides/html-to-pdf-nodejs)
- [Page numbers, headers and footers](https://pdfloom.dev/guides/page-numbers-headers-footers-pdf)
- [wkhtmltopdf alternatives](https://pdfloom.dev/guides/wkhtmltopdf-alternative)
- [HTML invoice template](https://pdfloom.dev/html-invoice-template)
## Comparisons
- [PDFLoom vs DocRaptor](https://pdfloom.dev/guides/pdfloom-vs-docraptor): Chrome vs Prince engine, pricing
- [PDFLoom vs PDFShift](https://pdfloom.dev/guides/pdfloom-vs-pdfshift): flat plans vs credits, limits
- [PDFLoom vs Api2Pdf](https://pdfloom.dev/guides/pdfloom-vs-api2pdf): flat plans vs pay-per-use (Api2Pdf is cheaper for small fast docs)
## Optional
- [Pricing](https://pdfloom.dev/pricing): Free 100/mo, Starter $9 (2,000), Pro $29 (10,000), Scale $79 (50,000)
- [Free invoice generator](https://pdfloom.dev/invoice-generator) (web tool, no API key)