{"openapi":"3.1.0","info":{"title":"PDFLoom API","version":"1.0.0","description":"Convert HTML or a URL to PDF with headless Chrome, or generate invoice/receipt/quote PDFs from JSON. Every successful call counts as one PDF against the monthly quota. REST API documents are rendered in memory and never stored. An MCP server is also available at https://pdfloom.dev/mcp (see https://pdfloom.dev/docs#mcp).","contact":{"url":"https://pdfloom.dev/contact"}},"servers":[{"url":"https://pdfloom.dev"}],"security":[{"bearerAuth":[]},{"apiKeyHeader":[]}],"externalDocs":{"url":"https://pdfloom.dev/docs"},"paths":{"/v1/pdf":{"post":{"operationId":"renderPdf","summary":"Convert HTML or a URL to PDF","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PdfRequest"},"examples":{"html":{"value":{"html":"<h1>Invoice #1042</h1><p>Total: $120.00</p>","format":"A4","margin":"20mm"}},"url":{"value":{"url":"https://example.com","format":"Letter"}},"pageNumbers":{"value":{"html":"<h1>Report</h1>","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":{"200":{"description":"The rendered PDF.","headers":{"X-Usage":{"description":"PDFs used this month / monthly quota, e.g. \"12/100\".","schema":{"type":"string"}}},"content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Invalid parameters, or the page failed to render.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Monthly quota reached, or too many requests per minute.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Server busy. Retry after a few seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/invoice":{"post":{"operationId":"renderInvoice","summary":"Generate an invoice, receipt, quote, estimate or proforma PDF from JSON","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoiceRequest"},"examples":{"invoice":{"value":{"number":"INV-2026-0042","currency":"USD","date":"2026-10-18","due":"2026-11-01","from":"Acme Studio LLC\n500 Market St","to":"Globex Corp","items":[{"desc":"Website redesign","qty":1,"price":4800}],"tax":8.5}}}}}},"responses":{"200":{"description":"The rendered PDF.","headers":{"X-Usage":{"description":"PDFs used this month / monthly quota, e.g. \"12/100\".","schema":{"type":"string"}}},"content":{"application/pdf":{"schema":{"type":"string","format":"binary"}}}},"400":{"description":"Invalid parameters, or the page failed to render.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Monthly quota reached, or too many requests per minute.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Server busy. Retry after a few seconds.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/usage":{"get":{"operationId":"getUsage","summary":"Get this month's usage and quota","responses":{"200":{"description":"Usage for the current calendar month (UTC).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Usage"}}}},"401":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key from https://pdfloom.dev/dashboard, e.g. \"Bearer plk_...\""},"apiKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key"}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"]},"Usage":{"type":"object","properties":{"plan":{"type":"string","enum":["free","starter","pro","scale"]},"used":{"type":"integer"},"quota":{"type":"integer"},"month":{"type":"string","examples":["2026-10"]}},"required":["plan","used","quota","month"]},"Margin":{"oneOf":[{"type":"string","description":"One CSS length for all sides, e.g. \"20mm\"."},{"type":"object","properties":{"top":{"type":"string"},"right":{"type":"string"},"bottom":{"type":"string"},"left":{"type":"string"}}}]},"PdfRequest":{"type":"object","description":"Provide exactly one of `html` or `url`.","properties":{"html":{"type":"string","maxLength":5000000,"description":"HTML document to render."},"url":{"type":"string","format":"uri","description":"Public http(s) URL to render."},"format":{"type":"string","enum":["A4","Letter","Legal","Tabloid","Ledger","A0","A1","A2","A3","A5","A6"],"default":"A4","description":"Paper size (case-insensitive). Ignored if width/height is set."},"width":{"type":"string","description":"Custom page width, e.g. \"4in\" or \"100mm\"."},"height":{"type":"string","description":"Custom page height."},"landscape":{"type":"boolean","default":false},"margin":{"$ref":"#/components/schemas/Margin"},"printBackground":{"type":"boolean","default":true},"scale":{"type":"number","minimum":0.1,"maximum":2,"default":1},"displayHeaderFooter":{"type":"boolean","default":false},"headerTemplate":{"type":"string","description":"HTML; classes pageNumber, totalPages, date, title, url are filled in. Use inline styles and set a font-size."},"footerTemplate":{"type":"string","description":"Same as headerTemplate."},"pageRanges":{"type":"string","examples":["1-3, 5"]},"preferCSSPageSize":{"type":"boolean","default":false,"description":"Use the size from CSS @page rules."},"waitUntil":{"type":"string","enum":["load","domcontentloaded","networkidle0","networkidle2"],"description":"Default: load for html, networkidle2 for url."},"emulateMedia":{"type":"string","enum":["print","screen"],"default":"print"}}},"InvoiceItem":{"type":"object","properties":{"desc":{"type":"string"},"qty":{"type":"number"},"price":{"type":"number","description":"Unit price."}},"required":["desc","qty","price"]},"InvoiceRequest":{"type":"object","required":["items"],"properties":{"items":{"type":"array","minItems":1,"maxItems":500,"items":{"$ref":"#/components/schemas/InvoiceItem"}},"docType":{"type":"string","enum":["invoice","receipt","quote","estimate","tax","proforma"],"default":"invoice","description":"Changes the title and labels."},"language":{"type":"string","enum":["en","sv","da","nb","fi","de","nl","fr","es","it"],"default":"en","description":"Labels and number/date formatting: en, sv, da, nb, fi, de, nl, fr, es, it."},"number":{"type":"string"},"currency":{"type":"string","enum":["USD","EUR","GBP","CAD","AUD","SEK","NOK","DKK","CHF","JPY","INR","BRL","MXN","ZAR","NZD","SGD","PLN"],"default":"USD"},"date":{"type":"string","format":"date"},"due":{"type":"string","format":"date","description":"Due date, or valid-until / paid-on depending on docType."},"from":{"type":"string","description":"Seller block; use \\n for line breaks."},"to":{"type":"string","description":"Buyer block; use \\n for line breaks."},"tax":{"type":"number","description":"Tax rate in percent, applied after discount."},"discount":{"type":"number","description":"Absolute amount."},"shipping":{"type":"number","description":"Absolute amount."},"notes":{"type":"string"},"logo":{"type":"string","description":"https:// image URL or base64 data:image/... URI."},"accentColor":{"type":"string","pattern":"^#([0-9a-fA-F]{3}){1,2}$"},"taxLabel":{"type":"string","maxLength":24,"description":"Label for the tax line, e.g. \"VAT\" or \"GST\". Default \"Tax\"."},"qtyLabel":{"type":"string","maxLength":24,"description":"Column header, e.g. \"Hours\". Default \"Qty\"."},"priceLabel":{"type":"string","maxLength":24,"description":"Column header, e.g. \"Rate\". Default \"Unit price\"."}}}}}}