API Docs/Browser Automation
POST

Webpage to PDF API

Free Public API

Generate publication-grade PDF documents from HTML, URLs, and web apps with CSS paged media.

Try in Live Web Tool
POSThttps://api.headless-lender.com/api/v1/pdf
Public: No Key Needed•Highest Free Quota: 1,000 Req/Mo + 10h Browsers (No Card Required)

Overview & Architecture

Transform web pages, dashboards, invoices, and reports into publication-grade vector PDF documents. Supports custom page sizes (A4, Letter, Legal), print background graphics, margins, and page numbering.

Vector-sharp text rendering & embedded hyperlinks
CSS print media & @page rules compatibility
Precise page break control with page-break-inside rules
Custom margins and headers/footers
Playwright Execution & Valkey Caching Pipeline

Because this endpoint utilizes full headless Chromium rendering, dynamic JavaScript and single-page apps (SPAs) are executed completely before conversion:

1. Cold Scrape (Cache MISS)~800ms – 2.5s

Chromium initializes, fetches the URL, executes client JavaScript, resolves DOM mutations, and generates output.

2. Repeat Request (Cache HIT)~5ms – 15ms

Returned instantly from Valkey/Redis cache with header X-Lender-Cache: HIT (15-minute TTL).

Code Integration Examples

Instant Public Endpoint: Zero configuration, no API key needed. Want our highest free quota? Get 1,000 free requests/month + 10 hours of cloud browsers with a free key (No credit card required).
curl -X POST https://api.headless-lender.com/api/v1/pdf \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://blog.cloudflare.com",
    "options": {
      "format": "A4",
      "printBackground": true
    }
  }' --output document.pdf

Headers & Authentication Standard

1. Public Access (No Key)

No Authorization header required. Simply send a JSON POST request. Perfect for quick prototypes, small scripts, and low-volume scraping.

Content-Type: application/json

2. Free API Key (Highest Free Quota)

1,000 Req/Mo Free

Sign up in 10s with no credit card required. Unlocks 1,000 free monthly requests, 600 browser minutes (10 hours), 120 req/min burst limits, and cache-bypass controls.

Authorization: Bearer hl_live_your_api_key_here
Access ModeMonthly QuotaCloud Browser TimeBurst LimitCredit CardAction
Public AnonymousDaily IP Allowance5-min trial sandbox10 req/minNoneInstant (No Setup)
Free Account (Highest Quota)1,000 Req / Month600 Mins (10 Hours)120 req/minZero ($0 forever)Claim Free Key →

Request Body Parameters

FieldTypeRequiredDefaultDescription
urlstringrequired—Target webpage URL to convert into PDF.
options.format'A4' | 'Letter' | 'Legal' | 'A3'optional'A4'Standard paper sheet dimensions.
options.landscapebooleanoptionalfalseOrient pages in landscape mode.
options.printBackgroundbooleanoptionaltruePrint background colors, CSS gradients, and images.
options.scalenumber (0.1 - 2.0)optional1.0Web page rendering zoom scale.
options.margin{ top, right, bottom, left }optional—Custom margins in mm or px (e.g. 10mm).

Response Schema & Example

200 OK — application/jsonDuration: ~800ms (Cold) / ~8ms (Cached)
Binary stream of application/pdf