API Documentation

Authentication

All API requests require a Bearer token. Get your API key from the dashboard.

Authorization: Bearer pf_live_your_api_key

Generate PDF

POST /api/v1/generate

Sync mode (recommended)

Add ?sync=true to get the PDF in the response. No polling needed.

curl -X POST "https://pageforge.dev/api/v1/generate?sync=true" \
  -H "Authorization: Bearer pf_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"html": "<h1>Hello World</h1>"}' \
  --output hello.pdf

Async mode

Without ?sync=true, returns a job ID. Poll for the result.

# Submit
curl -X POST "https://pageforge.dev/api/v1/generate" \
  -H "Authorization: Bearer pf_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{"html": "<h1>Hello</h1>"}'

# Response: {"id": "abc-123", "status": "processing", "poll_url": "/api/v1/generations/abc-123"}

# Poll
curl "https://pageforge.dev/api/v1/generations/abc-123" \
  -H "Authorization: Bearer pf_live_your_key"

Request body

FieldTypeDescription
htmlstringHTML to render as PDF
urlstringURL to capture as PDF
optionsobjectPDF options (format, margins, etc.)
options.formatstringA4, Letter, Legal, A3, A5, Tabloid (default: A4)
options.landscapebooleanLandscape orientation (default: false)
options.marginobject{top, right, bottom, left} in CSS units (default: 1cm)
options.printBackgroundbooleanPrint background graphics (default: true)

List Generations

GET /api/v1/generations

curl "https://pageforge.dev/api/v1/generations?limit=10" \
  -H "Authorization: Bearer pf_live_your_key"

MCP Server

Use PageForge with AI assistants like Claude via our MCP server.

npx pageforge-mcp-server

Set PAGEFORGE_API_KEY environment variable. The MCP server provides generate_pdf, get_generation, and list_generations tools.