PDF generator API
This PDF generator API takes HTML or a public URL and returns a PDF. Rendering runs in headless Chromium in resource-limited worker containers, so what you see in a modern browser is what ends up in the file.
The output is the real file our engine returned for this request (page 1 for PDFs). HTML shortened for display; the full request is below.
In one sentence
A render API that turns HTML or a public web address into a PDF with one HTTP request, running headless Chromium in isolated, resource-limited worker containers.
Key facts
- Endpoint: POST https://api.aiipworld.com/v1/render with an API key as a Bearer token; send html or url, an output and options.
- Asynchronous: the call returns 202 with a job_id; poll GET /v1/jobs/:id until the status is succeeded, failed or timeout, then download from a short-lived signed link.
- Pricing: a simple PDF costs 1 credit; PDFs beyond 10 pages cost 1 more credit per 10 pages, and results beyond 5 MB cost more. Credits for failed jobs are returned. Credit costs are provisional until launch.
- Plans: Free 100 credits a month; Starter $19 a month for 2,750; Pro $59 for 10,000; Business $149 for 30,000; Scale $299 for 75,000; credit pack $10 for 1,400 credits that do not expire.
- Rate limits per minute: Free 30, Starter 60, Pro 180, Business 600, Scale 600. Results are kept 1 day (Free), 7 days (Starter, Pro) or 30 days (Business, Scale).
- Not available yet: webhooks, templates and WebP output.
What it does
- HTML in, PDF out, or a public URL in, PDF out, with one request to
POST /v1/render. - Headless Chromium does the rendering, so modern CSS, web fonts and JavaScript work as in the browser.
- Headers, footers with page numbers, margins, page ranges and wait conditions are options.
- Each job gets a fresh browser context in a resource-limited worker container, with a hard timeout; requests to private networks are blocked.
- Jobs are asynchronous: submit, poll, then fetch the file from a short-lived signed link.
Example: HTML to PDF with header and footer
Set AIIPWORLD_API_KEY to a key from your dashboard. The request below produced the example output further down.
curl -X POST https://api.aiipworld.com/v1/render \
-H "Authorization: Bearer $AIIPWORLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"html":"<!doctype html>\n<html><head><meta charset=\"utf-8\"><style>\nbody { font-family: Helvetica, Arial, sans-serif; color: #1a1d33; font-size: 12px; line-height: 1.5; margin: 0; }\nh1 { font-size: 28px; margin: 0 0 4px; color: #2036c9; }\nh2 { font-size: 15px; margin: 24px 0 10px; padding-bottom: 4px; border-bottom: 2px solid #2f4bff; }\n.sub { margin: 0 0 20px; color: #555; }\n.kpis { display: flex; gap: 12px; }\n.kpi { flex: 1; padding: 10px 12px; border: 1px solid #d9dcf5; border-radius: 8px; background: #f4f5ff; }\n.kpi b { display: block; font-size: 22px; }\n.kpi span { font-size: 11px; color: #555; }\n.bar { display: flex; align-items: center; gap: 10px; margin: 7px 0; }\n.bar i { width: 64px; font-style: normal; color: #444; }\n.bar div { height: 16px; border-radius: 3px; background: linear-gradient(90deg, #2f4bff, #7c5cff); }\n.bar em { font-style: normal; font-weight: bold; }\ntable { width: 100%; border-collapse: collapse; }\nth, td { padding: 6px 8px; border-bottom: 1px solid #e1e3f0; text-align: left; }\nth { background: #f0f2ff; }\n.n { text-align: right; }\ntfoot td { font-weight: bold; border-top: 2px solid #2f4bff; }\n.note { margin-top: 18px; padding: 10px 12px; border-left: 4px solid #7c5cff; background: #f7f5ff; }\nul { margin: 0; padding-left: 18px; }\nli { margin: 4px 0; }\n</style></head><body>\n<h1>Q3 2026 sales report</h1>\n<p class=\"sub\">Prepared for the leadership team. All figures are sample data.</p>\n<div class=\"kpis\">\n <div class=\"kpi\"><b>$291k</b><span>Revenue, Q3</span></div>\n <div class=\"kpi\"><b>+18%</b><span>Versus Q2</span></div>\n <div class=\"kpi\"><b>1,284</b><span>New customers</span></div>\n <div class=\"kpi\"><b>94.2%</b><span>Renewal rate</span></div>\n</div>\n<h2>Revenue by month</h2>\n<div class=\"bar\"><i>July</i><div style=\"width:55%\"></div><em>$82k</em></div>\n<div class=\"bar\"><i>August</i><div style=\"width:62%\"></div><em>$91k</em></div>\n<div class=\"bar\"><i>September</i><div style=\"width:80%\"></div><em>$118k</em></div>\n<div class=\"note\">September carried the quarter: an annual-plan promotion moved renewals into the month.</div>\n<h2>Revenue by region</h2>\n<table>\n <thead><tr><th>Region</th><th class=\"n\">Customers</th><th class=\"n\">Revenue</th><th class=\"n\">Share</th></tr></thead>\n <tbody>\n <tr><td>North America</td><td class=\"n\">512</td><td class=\"n\">$131,400</td><td class=\"n\">45%</td></tr>\n <tr><td>Europe</td><td class=\"n\">403</td><td class=\"n\">$93,100</td><td class=\"n\">32%</td></tr>\n <tr><td>Asia Pacific</td><td class=\"n\">261</td><td class=\"n\">$49,500</td><td class=\"n\">17%</td></tr>\n <tr><td>Rest of world</td><td class=\"n\">108</td><td class=\"n\">$17,000</td><td class=\"n\">6%</td></tr>\n </tbody>\n <tfoot><tr><td>Total</td><td class=\"n\">1,284</td><td class=\"n\">$291,000</td><td class=\"n\">100%</td></tr></tfoot>\n</table>\n<h2>Highlights</h2>\n<ul>\n <li>North America and Europe together brought in 77% of revenue.</li>\n <li>Asia Pacific grew fastest, with 261 customers against 190 in Q2.</li>\n <li>Rendered by headless Chromium through the AIIPWorld API.</li>\n</ul>\n</body></html>","output":"pdf","options":{"format":"A4","margin":{"top":"20mm","bottom":"20mm","left":"15mm","right":"15mm"},"display_header_footer":true,"header_template":"<div style=\"font-size:9px;width:100%;text-align:center;color:#666\">Quarterly report</div>","footer_template":"<div style=\"font-size:9px;width:100%;text-align:center;color:#666\">Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div>"}}'
# returns {"job_id": "...", "status": "queued"}; then poll:
curl https://api.aiipworld.com/v1/jobs/JOB_ID -H "Authorization: Bearer $AIIPWORLD_API_KEY"Example: a URL to PDF
curl -X POST https://api.aiipworld.com/v1/render \
-H "Authorization: Bearer $AIIPWORLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://aiipworld.com","output":"pdf","options":{"format":"A4","landscape":false}}'
# returns {"job_id": "...", "status": "queued"}; then poll:
curl https://api.aiipworld.com/v1/jobs/JOB_ID -H "Authorization: Bearer $AIIPWORLD_API_KEY"Example output
Options
Options go in the options object and are passed to the engine, which rejects unknown names.
| Option | What it does |
|---|---|
format, width, height | Paper size (A4 by default) or a custom size. |
landscape, margin | Orientation and per-side margins. The default margin is 10 mm on all four sides. |
print_background | Print CSS backgrounds (on by default). |
scale, page_ranges | Scale the content; print only some pages. |
display_header_footer, header_template, footer_template | HTML for a header and footer on every page (up to 64 KB each). |
prefer_css_page_size, tagged, outline | Use @page size from your CSS; tagged PDF; document outline. |
media | print (default) or screen styles. |
wait_until, wait_for_selector, delay_ms | When to consider the page ready; an extra delay up to 10 seconds. |
javascript, headers, user_agent, viewport, base_url | Turn scripts off, send up to 20 request headers, set the user agent and window size, resolve relative URLs. |
Pricing
One credit pool covers every tool and the API. A simple PDF costs 1 credit; PDFs beyond 10 pages and results beyond 5 MB cost more. Credits for failed jobs are returned. Credit costs are provisional until launch.
Free
$0
100 credits per month
Starter
$19 / month
2,750 credits per month
about $0.0069 per simple render
Pro
$59 / month
10,000 credits per month
about $0.0059 per simple render
Business
$149 / month
30,000 credits per month
about $0.0050 per simple render
Scale
$299 / month
75,000 credits per month
about $0.0040 per simple render
Per-render prices are plan price / credits x credits per render, for a plan used in full and billed monthly. See the full table on pricing.
Credit pack: $10 for 1,400 credits that do not expire. Rate limits and result retention depend on the plan: see pricing.
How the PDF generator API works
A PDF takes three steps. You send a request, you wait for the job to finish, and you download the file.
Send a POST request to /v1/render with html or url, and set output to pdf. The API answers with status 202 and a job_id.
Poll GET /v1/jobs/:id until the status is succeeded, failed or timeout. On success, read download_url. The link is short-lived, so download the file as soon as you get it.
What you can control in the PDF
Use format for a paper size such as A4 or Letter, or set width and height yourself. Use landscape to turn the page sideways.
The default margin is 10 mm on all four sides. Set top, right, bottom and left to change them one by one.
print_background is on by default. Turn it off for a plainer result.
Set display_header_footer to true to add headers and footers. Pass header_template and footer_template as HTML, up to 64 KB each. Page numbers use the classes pageNumber and totalPages.
If content loads late, use wait_for_selector or delay_ms, which can be up to 10000 ms.
HTML to PDF API versus URL to PDF
Use html when your software builds the document. Use url when the page already has a public http or https address. Set base_url with html if the markup uses relative links or images.
Requests to private networks, localhost and cloud metadata addresses are blocked, including redirects and sub-resources. file and ftp addresses are refused.
JavaScript runs by default, so a page that draws its content with scripts renders as it would in a browser.
The render server has Noto fonts for core and CJK text, Noto Color Emoji and Liberation 2. Fonts on your own machine are not there. Load other fonts with @font-face from a public URL or a data URL.
Authentication and limits
Send your API key from the dashboard as Authorization: Bearer followed by the key, or in the x-api-key header.
Each plan has its own rate limit per minute. Queue priority follows the plan, with Business first and Free last.
A simple render costs 1 credit. You can send up to 20 custom headers and set a user agent. There is no cookie option.
Common uses of a PDF API
Developers often use a PDF API for reports, statements and documentation produced by their own software.
The invoice tool on this site builds an A4 HTML invoice and then uses the same html_to_pdf step. Use it for real invoices only, as the Acceptable Use Policy requires.
What is not available yet
Templates, webhooks and a batch endpoint are not available yet.
The template_id field is reserved and returns an error, so send complete HTML. Send one request for each document.
Errors and retries
A failed job shows an error class such as invalid_input, ssrf_blocked, navigation_failed, output_limit, memory_limit or timeout.
invalid_input means the request is wrong. ssrf_blocked means the address is not allowed. navigation_failed means the page could not be loaded. timeout means the job ran out of time.
Credits for failed and timed-out jobs are returned. Fix the cause first, then send the request again.
Check the layout before you write code
If you are comparing a pdf generator api, start with the layout. Paste your markup into the HTML to PDF tool on this site. It uses the same engine as the API and shows you the PDF, so you can check page breaks, fonts and margins first.
When the output looks right, call the HTML to PDF REST API with the same markup. The web tools are free and need no account, so they are a quick way to test your markup before you start sending jobs.
API PDF generator for documents built in code
If you are looking for an api pdf generator, this one takes complete HTML or a public URL and returns a PDF from headless Chromium. Because the HTML is yours, you control the layout with ordinary CSS.
Questions
How does a request work?
POST /v1/render with either html or url and output set to pdf. You get a job id back, then poll GET /v1/jobs/{id} until the status is succeeded and read download_url. Jobs are asynchronous. Webhooks are not available yet.
How much does a PDF cost?
A simple render costs 1 credit. PDFs longer than 10 pages cost one more credit for each further 10 pages (or part of), and any result over 5 MB costs one more credit for each further 5 MB. Credits for failed and timed-out jobs are returned. These costs are provisional until launch.
Is there a free tier?
Yes. A free account includes 100 credits a month. The web tools also work without an account, within per-visitor limits.
How long are results kept?
Free API results are kept 1 day. Starter and Pro keep them 7 days, Business and Scale 30 days. The download link is a short-lived signed link; request the job again for a fresh one.
Can I make PDFs from a template and JSON data?
Not yet. The template_id field is reserved and currently returns an error. Today you send complete HTML.
Is it safe to render user-supplied HTML?
Each job renders in a fresh browser context inside a resource-limited worker container, with a hard timeout, and requests to private networks, localhost and cloud metadata addresses are blocked. You are still responsible for what you render; see the Acceptable Use Policy.
Are headers and footers supported?
Yes. Set display_header_footer to true and pass header_template and footer_template HTML. Page numbers use the pageNumber and totalPages classes. Leave enough top and bottom margin for them.
How do I get an API key?
Get your key from the dashboard. Send it in the Authorization header as Bearer followed by the key, or in the x-api-key header.
What happens if a job fails?
The job status changes to failed or timeout, and the error class tells you what went wrong. Credits for failed and timed-out jobs are returned, so you do not pay credits for them.
Is there a rate limit?
Yes. Each plan has its own limit per minute. The limit rises from Free to Starter, Pro and Business.
Which programming languages can I use?
Any language or tool that can send HTTP requests. The examples above are a starting point, not a limit.
Can I get the PDF in the response to my first request?
No. The first response from this pdf generation api is a job id with status 202. Poll GET /v1/jobs/:id until the status is succeeded, then download the file from download_url. The link is short-lived, so download it soon.
How do I call the create PDF API from my own server?
Send the POST request from your server code, with your API key in the Authorization header as Bearer followed by the key. Keep the key on the server rather than in browser code, then poll the job until it finishes.
Can I export only some pages of a PDF?
Yes. Set page_ranges to the pages you want, such as one page or a span of pages. The other options, such as landscape and margin, still apply to the pages you export.
Can I convert Markdown to PDF with the API?
Yes. The API takes HTML, so convert the Markdown to HTML with a library in your language and send the result as html with output set to pdf. The Markdown to PDF tool on this site shows the same steps in a web page, and its API section has a Node.js example. There is no field that accepts Markdown directly.
Related tools
- HTML to PDF converterHTMLPDF
- URL to PDFURLPDF
- Invoice to PDFFormPDF
- A wkhtmltopdf alternative: headless Chromium over an APIGuide
- AIIPWorld as a DocRaptor alternativeComparison
- Screenshot APIAPI
- CSV to PDFCSVPDF
- Markdown to PDFMarkdownPDF
- Text to PDFTextPDF
- SVG to PDFSVGPDF
- JSON to PDFJSONPDF
- Estimate GeneratorFormPDF
- Purchase Order GeneratorFormPDF
- URL to MarkdownURLMarkdown
- Print CSS for PDF: a practical guideGuide
- HTML to PDF Python: a requests guideGuide
- HTML to PDF nodejs: a Node.js API guideGuide
- AIIPWorld as an html2pdf.js alternativeComparison
- AIIPWorld as a Firecrawl alternativeComparison
- C# HTML to PDF, PHP and Java guideGuide
