HTML to PDF API for developers and AI agents
Generate pixel-perfect PDFs from HTML and CSS โ powered by headless Chromium. Full support for Flexbox, Grid, and web fonts. Register programmatically, pay with USDC, monitor credits per-response.
Humans: 100 calls/month free. AI agents: 10 free calls via POST /api/register. No credit card required.
Unlike Dompdf, mPDF, and WeasyPrint โ no CSS subset restrictions. If it renders in Chrome, it renders in your PDF.
// Generate a PDF from HTML
const response = await fetch("https://api.docapi.co/v1/pdf", {
method: "POST",
headers: {
"x-api-key": "pk_live_xxx",
"Content-Type": "application/json",
},
body: JSON.stringify({
html: "<h1>Hello World</h1>",
}),
});Why developers switch from Puppeteer
Same Chromium rendering. None of the infrastructure.
| Puppeteer | Doc API | |
|---|---|---|
| Cold start | 3โ5 seconds | ~10 ms |
| Binary size | 150 MB+ | 0 MB (API call) |
| Lambda/Vercel setup | Custom layers, Docker | Works out of the box |
| Memory leaks | Common under load | Not your problem |
| CSS support | Full (you manage it) | Full (we manage it) |
| Integration code | 50+ lines | 3 lines |
Same headless Chromium under the hood โ without the ops burden.
Simple integration
Get started in minutes with your favorite language
curl -X POST https://api.docapi.co/v1/pdf \-H "x-api-key: pk_live_xxx" \-H "Content-Type: application/json" \-d '{"html": "<h1>Hello World</h1>"}' \--output document.pdf
Your agent registers. Your software runs forever.
One POST request gives an agent everything it needs to build self-funding PDF generation into the software it's building. No dashboards, no credit cards, no human in the loop.
Native MCP Server โ the only PDF API listed on every major MCP registry
Add one block to your config and Claude, Cursor, or Windsurf can generate PDFs directly. No code required.
"url": "https://mcp.docapi.co/mcp"Works with
The Agent Skill โ works with 43+ agents
Claude Code, GPT, Gemini, Cursor, and more. Install once and your agent can register, generate PDFs, and manage USDC credits without writing any integration code.
npx skills add docapiRegister via API, no browser
POST /api/register returns an API key and USDC address in one response. No email confirmation, no dashboard, no human step required.
Pay with USDC on Base
Agents don't have credit cards โ they have crypto wallets. Send USDC to your dedicated address on Base mainnet. Credits appear in seconds via webhook. 50 credits per 1 USDC ($0.02/call).
X-Credits-Remaining on every response
Every API response includes a credit balance header. Software watches this header and sends USDC proactively when it drops below 50. The 402 never happens.
10 free calls on registration
Test the API before committing to payment setup. Enough to validate output quality and integration correctness โ then fund and go.
{
"api_key": "pk_4a7f2b9c...",
"usdc_address": "0x2B984ee1...",
"free_calls": 10,
"credits_per_usdc": 50,
"network": "base-mainnet",
"rate": "$0.02 per API call",
"auto_topup": {
"header": "X-Credits-Remaining",
"recommended_threshold": 50,
"recommended_topup_usdc": 10
},
"on_exhausted": {
"http_status": 402,
"body": { "error": "credits_exhausted" }
},
"integration": {
// Python + JS snippets with topup loop
}
}See it in action
An agent self-registers, generates invoices, hits a 402, tops up autonomously with USDC, and resumes โ no human in the loop.
Simple, transparent pricing
Start free, scale as you grow
- 1,000 API calls/month
- Email support
- Full documentation
- Webhooks
- 5,000 API calls/month
- Priority support
- Full documentation
- Webhooks
- Custom fonts
- 20,000 API calls/month
- Dedicated support
- Full documentation
- Webhooks
- Custom fonts
- SLA guarantee
Pay-per-use with USDC
For AI agents that register and pay programmatically. No monthly commitment, no credit card. Register via POST /api/register, pay with USDC on Base, and get X-Credits-Remaining on every response so your software tops up automatically.
- 10 free calls on registration
- 50 credits per 1 USDC
- No monthly commitment
- Self-managing credit topup
- Dedicated USDC wallet address
- Optional low-balance email alert
Base mainnet ยท No signup
Frequently asked questions
How reliable is the API?+
Doc API runs on managed infrastructure with automatic scaling. You get the same headless Chromium rendering as Puppeteer โ without managing the process yourself. If a render fails, retry it. There's no browser to crash or leak memory on your side.
How fast is PDF generation?+
Cold start is roughly 10ms (vs. 3โ5 seconds with self-hosted Puppeteer). Actual render time depends on your HTML complexity, but most documents generate in under 2 seconds end-to-end.
Can I use this in production?+
Yes. The Pro and Business plans include priority and dedicated support respectively, plus SLA guarantees on Business. The Free tier is great for prototyping โ upgrade when you're ready to ship.
Do I need to use USDC / crypto?+
No. Human plans use standard monthly billing via Stripe. The USDC payment option exists specifically for AI agents that can't use credit cards. Pick whichever model fits your use case.
What CSS features are supported?+
Everything Chrome supports โ Flexbox, Grid, web fonts, Tailwind CSS, media queries, print stylesheets. If it renders in Chrome, it renders in your PDF.
What happens if I exceed my plan limit?+
API calls beyond your monthly limit return a 429 status. You can upgrade your plan anytime from the dashboard, or switch to the agent pay-per-use model for overflow.