Skip to main content

FileSlap API Quick Start

Convert HTML to a PDF in a single request. All requests require a valid API key.

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.pdf

Node.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

Endpoint: POST https://api.fileslap.com/api/convert
Required Headers:
  • • Content-Type: application/json
  • • X-API-KEY: Your API key
Request Body:
{
  "html": "<h1>Your HTML content</h1>"
}
Response: PDF file (application/pdf)

Developer Tools

OpenAPI Specification:
Postman Collection:

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.

The Ultimate Guide

Get the complete overview of all integration options and choose the perfect platform for your needs.

Read Ultimate Guide