Conversion API
One endpoint turns HTML or a URL into a PDF or an image, rendered in a real, up-to-date browser. Send JSON or an HTML file, get the file back in the response body.
For Postman, Insomnia or a generated client: the OpenAPI description.
Parameters
JSON body, Content-Type: application/json. Only html is required. Unknown parameters are rejected, so a typo never fails silently. null means “not set”.
Source
| Name | Type | Default | Description |
|---|---|---|---|
| htmlrequired | string | – | The HTML to convert, or a public URL (http or https) to open. Up to 5 MB; for larger pages pass a URL. Not needed with templateId. |
| templateId | string | – | Instead of html: the id of a template you saved in your dashboard (under Templates). It is filled in with data. |
| data | object | – | The values for templateId, as JSON. {{name}} in the template prints a value (HTML-escaped), {{#items}}…{{/items}} repeats for each item of a list. |
| css | string | – | Override CSS for this request, e.g. a customer’s brand colours: added after the styles of the HTML (or of the template, including its own override CSS), so it wins. Plain CSS, not filled with data. Works with html and templateId, not with a URL. |
Output
| Name | Type | Default | Description |
|---|---|---|---|
| output | "pdf" | "png" | "jpeg" | "pdf" | What to produce: a PDF, or a screenshot of the page as PNG or JPEG. Screenshots cost credits like PDFs (1 per started MB). |
| filename | string | – | File name for the result (sent in Content-Disposition). ".pdf", ".png" or ".jpg" is added when missing. |
Page
| Name | Type | Default | Description |
|---|---|---|---|
| format | "Letter" | "Legal" | "Tabloid" | "Ledger" | "A0" | "A1" | "A2" | "A3" | "A4" | "A5" | "A6" | "A4" | Paper size. Ignored when width and height are set, and for screenshots. |
| landscape | boolean | false | Landscape orientation. |
| width | integer (px) | – | Custom page width in CSS pixels (96 per inch). Use together with height. Screenshots: the browser window width (default 1280). |
| height | integer (px) | – | Custom page height in CSS pixels. Use together with width. Screenshots: the browser window height (default 800). |
| singlePage BasicPlusProEnterprise | boolean | false | Put the whole document on one page as tall as the content (up to 200 inches). Width comes from width or format; height is ignored. |
| marginTop | integer (px) | 0 | Top margin in CSS pixels. |
| marginRight | integer (px) | 0 | Right margin in CSS pixels. |
| marginBottom | integer (px) | 0 | Bottom margin in CSS pixels. |
| marginLeft | integer (px) | 0 | Left margin in CSS pixels. |
Rendering
| Name | Type | Default | Description |
|---|---|---|---|
| media | "screen" | "print" | "screen" | Which CSS media type to apply: screen styles (as in a browser window) or your @media print rules. |
| printBackground | boolean | true | Print background colours and images. |
| scale | number (0.1–2) | 1 | Zoom factor for the content. Screenshots: the pixel density, e.g. 2 for a sharp (retina) image twice the size. |
| waitFor | number (0–10 s; Free: 0–3 s) | 0 | Extra seconds to wait after the page loaded, for content added by JavaScript. |
| lazyLoad | boolean | – | Scroll through the page first, so images and sections that load or fade in on scroll appear (stops after 12 s). Default: on for URLs, off for HTML; set false to skip it for a URL. |
| acceptCookies | boolean | – | Click "Accept all" on cookie banners first, so they don’t cover the page. Works with the common consent tools (OneTrust, Cookiebot, Didomi, Usercentrics and more) and banners in most European languages. Default: on for URLs, off for HTML; set false to capture the page as a first-time visitor sees it. |
Header & footer
| Name | Type | Default | Description |
|---|---|---|---|
| headerTemplate BasicPlusProEnterprise | string (HTML) | – | HTML printed at the top of every page. Elements with the classes pageNumber, totalPages, date, title and url are filled in. Needs a top margin to be visible. |
| footerTemplate BasicPlusProEnterprise | string (HTML) | – | Like headerTemplate, at the bottom of every page. Needs a bottom margin. |
Screenshot
| Name | Type | Default | Description |
|---|---|---|---|
| fullPage | boolean | – | Screenshots only. Capture the whole page (default), or false for just the browser window. Pages are cut off at 16384 device pixels. |
| quality | integer (1–100) | – | JPEG screenshots only. Image quality; higher is sharper and larger. Default 80. |
Security
| Name | Type | Default | Description |
|---|---|---|---|
| userPassword BasicPlusProEnterprise | string | – | Password needed to open the PDF. Setting it (or ownerPassword) encrypts the file with AES-256. |
| ownerPassword BasicPlusProEnterprise | string | – | Password that lifts the permission restrictions. Random when you set only userPassword. |
| permissions BasicPlusProEnterprise | array of "print", "modify", "copy", "edit", "fillform", "extract", "assemble", "printbest" | ["print"] | What readers may do with an encrypted PDF without the owner password. |
Async
| Name | Type | Default | Description |
|---|---|---|---|
| callBackUrl | string (URL) | – | Plus, Pro and Enterprise plans. Convert in the background: the API answers 202 at once and POSTs {"document": base64 file, "state": …, "contentType": "application/pdf"} to this public URL when done. |
| state | string | – | Any text (up to 1 KB) returned unchanged in the callback, e.g. your order id or a secret to verify the callback. |
Responses
- 200: the file itself (
application/pdf, orimage/png/image/jpegfor screenshots). Write the body to a file; don't parse it as JSON. Headers:X-Credits-Charged,X-Credits-RemainingandContent-Disposition(with your filename). - 202: accepted for background conversion (requests with callBackUrl).
- 4xx / 5xx: JSON with an error code and a readable message, see Errors.
Sending an HTML file
Instead of JSON, you can send an HTML file as it is: as the request body with Content-Type: text/html and the options in the query string, or as a multipart form with the file in the file field and the options as other fields. Every option works as in JSON: write booleans as true or false, and lists like permissions comma-separated. The same 5 MB limit applies.
curl "https://api.printpipe.io/v1/generate?format=A4&marginTop=40&filename=report" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: text/html" \
--data-binary @report.html \
--output report.pdfcurl https://api.printpipe.io/v1/generate \
-H "X-API-Key: $API_KEY" \
-F "[email protected]" \
-F "format=A4" \
-F "permissions=print,copy" \
--output report.pdfRelative links in the file (<img src="logo.png">) can't load, because the page has no address of its own. Use absolute URLs, or embed images and fonts as data: URIs.
Screenshots
Set output to "png" or "jpeg" to get an image of the page instead of a PDF, on every plan. Images cost credits like PDFs: 1 per started MB.
{
"html": "https://example.com",
"output": "png",
"width": 1440,
"fullPage": true,
"scale": 2
}widthandheightset the browser window (default 1280 × 800).fullPage(default true) captures the whole page; false captures only the window.scaleis the pixel density: 2 gives a sharp image twice the size, like on a retina screen.quality(1–100) applies to JPEG.- PDF-only options (margins, landscape, headers and footers, passwords, singlePage) are refused with screenshots, so mistakes don't go unnoticed. Free plan images carry the same small watermark as PDFs.