Get your API key

Generate PDFs with AI agents

PDF4.dev is the first PDF API with a built-in MCP server. Connect your favorite AI tool and generate PDFs with natural language, no code needed.

How it works

1. Create a free account

Claude, Claude Code and ChatGPT sign you in with OAuth, no key needed. Other clients use an API key from API keys.

2. Connect your AI tool

Add the PDF4.dev MCP server to your AI client configuration (see below).

3. Ask in natural language

“Generate an invoice for Acme Corp”, your agent handles the rest.

MCP server setup

Add PDF4.dev as an MCP server in your preferred AI client. Claude, Claude Code and ChatGPT sign you in with OAuth; Cursor, VS Code, Windsurf, Codex and Gemini CLI send an API key in the Authorization header. The key is never a tool parameter. How the sign-in works

claude mcp add --transport http pdf4dev https://pdf4.dev/api/mcp
# then run /mcp in Claude Code and choose "Authenticate":
# sign in to PDF4.dev, pick an organization, and allow access.

# Or with an API key instead of signing in:
claude mcp add --transport http pdf4dev https://pdf4.dev/api/mcp \
  --header "Authorization: Bearer p4_live_xxx"
Run this in your terminal. Signing in needs no API key; the key is the option for scripts and CI.

14 tools, full PDF lifecycle

Generate, preview, manage templates and components, and monitor usage. All accessible via natural language. Each tool includes MCP annotations so AI agents know which tools are safe to call without confirmation.

Docs the agent can read on demand

Resources let AI agents pull reference material directly from the MCP server. Each one is a short markdown doc covering a specific part of PDF4.dev.

Guided workflows for common tasks

Prompts package a multi-step task into a single slash command. The agent collects the arguments, then chains the right MCP tools to get the job done.

Built-in Handlebars helpers

All templates have access to formatting, logic, and math helpers. No setup needed, just use them in your HTML.

Formatting

Format numbers, dates, and currencies with locale support.

{{formatNumber 10000 "en-US"}}10,000{{formatDate date "short"}}Mar 8, 2026{{formatCurrency 1500 "EUR" "fr-FR"}}1 500,00 €

Logic & comparison

Conditionals and comparisons for dynamic content.

{{#if (eq status "paid")}}Paid{{/if}}Paid{{#each items}}...{{/each}}Loop over arrayseq, neq, gt, lt, gte, lteComparison helpers

Text & math

String transforms and arithmetic operations.

{{uppercase value}}HELLO{{math price "*" quantity}}(product){{padStart id 5 "0"}}00042

Just describe what you want

The AI agent picks the right tools automatically. Here are some things you can ask.

invoice.htmlreceipt.htmlClaudeDesign me a modern invoice wit…×
Design me a modern invoice with my company logo and colors
✓
create_templatetmpl_xK2m · created
name: "Modern Invoice"html: 312 lines
✓
render_pdf2.1 MB · 340ms
template_id: "modern-invoice"data: sample

Invoice template created with your brand colors and logo. Here's a preview with sample data.

Claude_...
Queue another message...
▶▶Edit automatically</> 1 line selected◑ 42% used/■

Ready to generate PDFs with AI?

Create a free account, then sign in from Claude or ChatGPT, or paste an API key into any other MCP client.

Create your free account