Home / APIs / HTML to PDF API

HTML to PDF & URL to PDF API

Generate PDFs from HTML uploads or public URLs. Use async PDF routes (/v1/pdf/from-html, /v1/pdf/from-url) for job-based workflows, or POST /v1/web/to-pdf for a synchronous website-to-PDF capture.

Features

What this API actually supports in production today.

  • HTML file → PDF (async)
  • Public URL → PDF (async pdf/from-url)
  • Sync website → PDF via /v1/web/to-pdf
  • SSRF-safe URL fetching
  • Gotenberg Chromium rendering

Common use cases

  • Invoice and report generation from HTML templates
  • Archive public pages as PDF
  • Replace headless Chrome fleets for simple captures

API endpoints

Base URL https://thefatbaby.com/api. Authenticate with Authorization: Bearer fb_live_YOUR_KEY.

MethodPathSummaryCredits
POST/v1/pdf/from-htmlHTML upload to PDF (async)Base + per-page style billing
POST/v1/pdf/from-urlURL to PDF (async)About 2 credits (catalog)
POST/v1/web/to-pdfWebsite to PDF (sync binary)5 credits default

Examples

Primary endpoint /v1/pdf/from-url · from-url ~2 catalog credits; web/to-pdf default 5 credits; from-html scales with pages.

cURL

curl -X POST https://thefatbaby.com/api/v1/pdf/from-url \
  -H "Authorization: Bearer fb_live_YOUR_KEY" \
  -F "url=https://example.com/invoice"

curl -X POST https://thefatbaby.com/api/v1/web/to-pdf \
  -H "Authorization: Bearer fb_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com"}' --output page.pdf

JavaScript

const form = new FormData();
form.append('url', 'https://example.com/invoice');
const res = await fetch('https://thefatbaby.com/api/v1/pdf/from-url', {
  method: 'POST',
  headers: { Authorization: 'Bearer fb_live_YOUR_KEY' },
  body: form
});
const { job } = await res.json();

Python

import requests
r = requests.post(
  'https://thefatbaby.com/api/v1/web/to-pdf',
  headers={'Authorization': 'Bearer fb_live_YOUR_KEY'},
  json={'url': 'https://example.com'},
)
open('page.pdf','wb').write(r.content)

Request

{ "url": "https://example.com" }

Binary response: web/to-pdf returns application/pdf bytes; pdf/from-* return job JSON for polling

Pricing & credits

Choose sync web/to-pdf (5 cr default) or async PDF conversion routes depending on your workflow.

Common errors

  • 400Invalid URL or HTML input
  • 402insufficient_credits

FAQ

Will complex SPAs render perfectly?

Rendering uses Gotenberg Chromium after a safe fetch. Extremely JS-heavy apps may need your own browser automation; FatBaby targets practical HTML/URL captures.

Async vs sync?

pdf/from-html and pdf/from-url are async jobs. web/to-pdf returns the PDF body directly.

Try without code

Use the matching online tool, then automate the same workflow with this API.