API Documentation
Authentication
All API requests require a Bearer token. Get your API key from the dashboard.
Authorization: Bearer pf_live_your_api_keyGenerate 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.pdfAsync 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
| Field | Type | Description |
|---|---|---|
| html | string | HTML to render as PDF |
| url | string | URL to capture as PDF |
| options | object | PDF options (format, margins, etc.) |
| options.format | string | A4, Letter, Legal, A3, A5, Tabloid (default: A4) |
| options.landscape | boolean | Landscape orientation (default: false) |
| options.margin | object | {top, right, bottom, left} in CSS units (default: 1cm) |
| options.printBackground | boolean | Print 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-serverSet PAGEFORGE_API_KEY environment variable. The MCP server provides generate_pdf, get_generation, and list_generations tools.