FileSlap API Quick Start
Convert HTML to a PDF in a single request. All requests require a valid API key. Only html is required; everything else is optional.
cURL
curl -X POST https://api.fileslap.com/api/convert \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{"html": "<h1>Hello World</h1>"}' \
--output hello.pdfExample with layout, margins, a short post-load wait (for client-rendered content), and a suggested filename:
curl -X POST https://api.fileslap.com/api/convert \
-H "Content-Type: application/json" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"html": "<html><body><h1>Report</h1></body></html>",
"format": "Letter",
"landscape": true,
"marginTop": "0.4in",
"marginRight": "0.4in",
"marginBottom": "0.4in",
"marginLeft": "0.4in",
"delayMs": 500,
"filename": "monthly-report"
}' \
--output report.pdfNode.js
import fetch from "node-fetch";
import fs from "fs";
const res = await fetch("https://api.fileslap.com/api/convert", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY"
},
body: JSON.stringify({ html: "<h1>Hello World</h1>" })
});
if (!res.ok) {
throw new Error(`HTTP ${res.status}`);
}
const buffer = await res.arrayBuffer();
fs.writeFileSync("hello.pdf", Buffer.from(buffer));Python
import requests
response = requests.post(
"https://api.fileslap.com/api/convert",
headers={
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY"
},
json={"html": "<h1>Hello World</h1>"}
)
if response.status_code == 200:
with open("hello.pdf", "wb") as f:
f.write(response.content)
else:
print(f"Error: {response.status_code}")JavaScript (Browser)
const response = await fetch("https://api.fileslap.com/api/convert", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-KEY": "YOUR_API_KEY"
},
body: JSON.stringify({ html: "<h1>Hello World</h1>" })
});
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = "hello.pdf";
a.click();
window.URL.revokeObjectURL(url);API Reference
- • Content-Type: application/json
- • X-API-KEY: Your API key
All fields below are optional except html. Invalid values return 400 with a short error message.
- •
html(string, required) — HTML document to render. - •
format(string, optional) — Paper size name understood by the renderer (for exampleA4,Letter). Default when omitted isA4. - •
landscape(boolean, optional) — Whentrue, renders in landscape orientation. - •
marginTop,marginRight,marginBottom,marginLeft(number or string, optional) — Per-side margin. Numbers are interpreted as pixels; strings can include units (for example"0.5in"). If you omit margins, the service uses its default margin preset. - •
delayMs(number, optional) — Milliseconds to wait after load before generating the PDF (useful for JS-rendered content). Capped at 10 000. - •
filename(string, optional) — Base name for the generated file; non-alphanumeric characters are stripped server-side.
Background colors and images are included in the PDF using print-style rendering. There is no separate request flag for backgrounds.
application/pdf)Common use cases
- • Invoices and receipts — Fixed margins and A4 or Letter for print-ready customer PDFs.
- • Reports — Landscape tables and explicit margins for dense data.
- • Dashboards — A short
delayMsso charts and client-rendered widgets finish before capture. - • Print-ready documents — Format, orientation, and margins aligned with how the document will be printed or archived.
Developer Tools
Complete Integration Guides
Step-by-step guides for every major platform. From Node.js to no-code tools, we've got you covered with production-ready code examples.
Node.js Integration
Convert HTML to PDF with Node.js - Complete guide with Express.js and Next.js integration
Python Integration
Generate PDFs with Python - Flask, Django, and async processing examples
React Integration
Convert React components to PDFs - Browser-based generation with custom hooks
Zapier Integration
Automate PDF generation with Zapier - No-code workflows for business automation
Make.com Integration
Advanced automation with Make.com - Complex workflows and multi-source data
n8n Integration
Self-hosted automation with n8n - Developer-focused workflows with unlimited flexibility
Google Apps Script
Automate PDF generation in Google Workspace - Sheets, Forms, and Gmail integration
The Ultimate Guide
Get the complete overview of all integration options and choose the perfect platform for your needs.
Read Ultimate Guide