HTML to PDF API
Generate PDFs from a URL or raw HTML with one API call. FileAlloy renders your markup with CSS support, returns the PDF in the response, and keeps inputs in memory only. Use it for invoices, receipts, reports, and other document workflows.
Inputs are processed in memory and never stored.
How to use HTML to PDF API
- Get a free API key Create an account at app.filealloy.com and generate a key. The free plan is enough to start.
- POST a URL or HTML Send JSON to /v1/html-to-pdf with either a url to render or a raw html string.
- Get a PDF A rendered PDF comes straight back in the response, ready to serve or store.
Why FileAlloy
URL or raw HTML
Point it at a live page with a url, or send your own html markup directly. Both produce a PDF.
Modern rendering
Pages are rendered with full CSS support, so the PDF matches what a browser would show.
Never persisted
The page, its assets, and the output PDF stay in memory for the request only, then are dropped.
Free tier to start
Create a free key, test the API with your own markup, then scale when the workflow is ready.
Do it at scale with the API
Generating invoices, receipts, or reports from HTML templates? The same operation is a single call to /v1/html-to-pdf, so you can batch and automate it with no browser.
curl -X POST https://api.filealloy.com/v1/html-to-pdf \
-H "X-API-Key: fa_live_your_key" \
-H "Content-Type: application/json" \
-d '{"html":"<h1>Invoice #1042</h1><p>Paid in full</p>"}' \
-o invoice.pdf Node.js
import { writeFile } from "node:fs/promises";
const response = await fetch("https://api.filealloy.com/v1/html-to-pdf", {
method: "POST",
headers: {
"X-API-Key": process.env.FILEALLOY_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ html: "<h1>Invoice #1042</h1>" }),
});
await writeFile("invoice.pdf", Buffer.from(await response.arrayBuffer())); Python
import os
from pathlib import Path
import requests
response = requests.post(
"https://api.filealloy.com/v1/html-to-pdf",
headers={"X-API-Key": os.environ["FILEALLOY_API_KEY"]},
json={"html": "<h1>Invoice #1042</h1>"},
)
response.raise_for_status()
Path("invoice.pdf").write_bytes(response.content) Frequently asked questions
Can I convert a live web page?
Yes. Send a url and the page is fetched and rendered to PDF. You can also send raw html instead.
Does it support CSS and web fonts?
Yes. Pages render with full CSS, so styled invoices, receipts, and reports come out looking right.
Are my inputs stored?
No. The HTML or URL and the resulting PDF are processed in memory and deleted immediately after the response.
What is the endpoint?
POST /v1/html-to-pdf with a JSON body containing url or html.
Can I use this HTML to PDF API with Node.js or Python?
Yes. The endpoint accepts standard JSON over HTTPS, so you can call it from Node.js, Python, or any language that can make an HTTP request.
Is this good for invoices and receipts?
Yes. Rendering an HTML template to PDF is the common way to generate invoices, receipts, and reports on demand.
Is there a free option?
Yes. The free plan includes a monthly request quota, with sub-cent pricing above it.