# html-pdf.com
> HTML to PDF API and MCP server for AI agents. Send HTML (or a public URL), get a PDF rendered by headless Chrome. 1 credit = 1 PDF page, 100 free credits once the email is confirmed, credits never expire, no subscription.
## Setup (for AI agents)
If the user asked you to set up html-pdf.com:
1. Check for an existing key in the environment variable `HTML_PDF_KEY`. If present, skip to step 4.
2. Ask the user for their email, then create the account:
`curl -X POST https://html-pdf.com/v1/signup -H "Content-Type: application/json" -d '{"email":""}'`
The response contains `api_key` (shown once). The 100 free credits are added when the user opens the link we email them (it confirms the email). Until then conversions return `403 email_not_confirmed`: ask the user to click the link, then retry.
If you get `409 account_exists`, tell the user to open the emailed link and paste you an API key from the dashboard.
3. Save the key where the user wants it (e.g. `HTML_PDF_KEY` in `.env`, never committed to git).
4. Either call the REST API directly, or add the MCP server so you can create PDFs in future conversations:
- Claude Code: `claude mcp add --transport http html-pdf https://html-pdf.com/mcp --header "Authorization: Bearer $HTML_PDF_KEY"`
- Other clients: see https://html-pdf.com/mcp.md
5. Test it: convert `Hello from html-pdf.com
` and give the user the PDF.
## Convert
```
curl https://html-pdf.com/v1/pdf -H "Authorization: Bearer $HTML_PDF_KEY" -H "Content-Type: application/json" -d '{"html":"Hello
","format":"A4"}' -o out.pdf
```
URL to PDF: `{"url":"https://example.com","media":"screen"}` instead of `html` (public pages only).
Tips: send a complete HTML document with inline or