Documentation

Everything you need to convert URLs into branded PDFs.

Introduction

The PDF API accepts a URL and returns a PDF. It supports WordPress Application Password authentication, Divi builder rendering, custom branded headers/footers, and per-tenant branding defaults.

Base URL: https://pdftool.kkiani.com

Authentication

All API requests require an API key sent in the x-api-key header. Get your key from the portal after signing up.

x-api-key: pdfa_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Quickstart

Generate your first PDF in one request:

cURL
JavaScript
Python
$ curl -X POST https://pdftool.kkiani.com/api/v1/generate-pdf \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_API_KEY" \ -d '{"url": "https://example.com"}' \ --output example.pdf
const response = await fetch('https://pdftool.kkiani.com/api/v1/generate-pdf', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': 'YOUR_API_KEY' }, body: JSON.stringify({ url: 'https://example.com' }) }); const pdfBlob = await response.blob();
import requests response = requests.post( 'https://pdftool.kkiani.com/api/v1/generate-pdf', headers={'x-api-key': 'YOUR_API_KEY'}, json={'url': 'https://example.com'} ) with open('example.pdf', 'wb') as f: f.write(response.content)

Generate PDF

POST/api/v1/generate-pdf

Converts a URL to a PDF. Returns the PDF binary with Content-Type: application/pdf.

Request body

FieldTypeDescription
urlstringRequired. URL of the page to convert.
wpAuthobjectOptional. WordPress credentials for protected pages.
optionsobjectOptional. See sections below.

options (PDF settings)

FieldTypeDescription
formatstringA4, A3, A5, Letter, Legal, Tabloid, Ledger. Default: A4.
landscapebooleanLandscape orientation. Default: false.
printBackgroundbooleanRender background colors/images. Default: true.
scalenumberRender scale (0.1 – 2). Default: 1.
marginobject{top, right, bottom, left} in cm/mm/px. Default: 1cm.
viewportobject{width, height}. Default: 1920×1080.
waitUntilstringnetworkidle, load, domcontentloaded. Default: domcontentloaded.
navigationTimeoutnumberms. Default: 45000.
customCSSstringCustom CSS injected into the page before rendering.
hideElementsstring[]CSS selectors to hide.

options.diviOptions

Divi builder support — template unwrapping, column layout, lazy image loading.

FieldTypeDescription
enabledbooleanEnable Divi processing. Default: false.
waitForSectionsbooleanWait for .et_pb_section to render. Default: true.
disableAnimationsbooleanNeutralize Divi animations. Default: true.
handleLazyImagesbooleanScroll to trigger lazy-loaded images. Default: true.

Tip: Add CSS class hideprint or noprint to any WP element to exclude it from the PDF.

options.pdfHeader

Branded header and footer on every page.

FieldTypeDescription
titlestringRequired. Document title shown in header.
subtitlestringShown in footer left.
logoUrlstringLogo image URL (fetched and embedded).
confidentialbooleanShow red CONFIDENTIAL badge. Default: false.
showRefbooleanShow document reference code. Default: true.

wpAuth

Authenticate into protected WordPress pages using Application Passwords. Requires the PDF API WordPress plugin installed on the target site.

FieldTypeDescription
usernamestringWordPress username.
applicationPasswordstringApp password from WP profile.

Full example

{ "url": "https://example.com/protected-page", "wpAuth": { "username": "editor", "applicationPassword": "xxxx xxxx xxxx xxxx xxxx xxxx" }, "options": { "format": "A4", "landscape": true, "printBackground": true, "diviOptions": { "enabled": true }, "pdfHeader": { "title": "Product Guide", "subtitle": "Brand Portal", "logoUrl": "https://example.com/logo.png", "confidential": true }, "hideElements": [".hideprint", ".admin-bar"] } }

Stats

GET/api/v1/stats

Returns usage stats scoped to your tenant (total PDFs, success rate, daily counts, top URLs, recent jobs).

WordPress Plugin

The PDF API WordPress plugin provides a secure proxy so API credentials never reach the browser. It also adds a Download PDF button to any page via shortcode or auto-inject.

Features

Shortcode examples

[pdf_download] [pdf_download title="My Product Guide"] [pdf_download landscape="true" confidential="false"] [pdf_download button_text="Download as PDF"]

Orientation defaults to portrait — best for content-heavy multi-section pages. Use landscape="true" on single-product spotlight pages where one large hero image sits beside text.

Error codes

CodeMeaningDescription
400Bad RequestInvalid request body or parameters.
401UnauthorizedMissing API key or WP auth failed.
403ForbiddenInvalid API key.
408Request TimeoutPage load timeout exceeded.
422Navigation FailedURL unreachable or failed to load.
429Too Many RequestsRate limit or monthly quota exceeded.
500Server ErrorUnexpected error.
502Bad GatewayCould not reach WordPress.

Ready to start?

Create your free account →