P. PDFHub

HTML-to-PDF API

One endpoint, one credit per conversion. Send raw HTML or a public URL and receive a Chromium-rendered PDF back in the response body. Base URL: https://pdf-hub.net/api/v1

Authentication

Pass your key in the Authorization header (or X-API-Key). Keys are created from your dashboard and start with ph_live_.

Header
Authorization: Bearer ph_live_xxxxxxxxxxxxxxxxxxxx

POST /convert

Renders source — raw HTML, or a URL if the string starts with http(s):// — and returns the PDF binary (application/pdf). The X-Credits-Remaining response header tells you your balance.

Convert a URL
curl -X POST https://pdf-hub.net/api/v1/convert \
  -H "Authorization: Bearer ph_live_…" \
  -H "Content-Type: application/json" \
  -d '{"source": "https://example.com", "format": "A4", "landscape": false}' \
  --output example.pdf
Convert raw HTML
curl -X POST https://pdf-hub.net/api/v1/convert \
  -H "Authorization: Bearer ph_live_…" \
  -H "Content-Type: application/json" \
  -d '{"source": "<html><body><h1>Invoice #881</h1></body></html>", "filename": "invoice-881.pdf"}' \
  --output invoice-881.pdf

Parameters

FieldTypeDefaultDescription
sourcestringrequiredRaw HTML markup, or a public http(s) URL. Max 2 MB.
formatstringA4A3, A4, A5, Letter, Legal or Tabloid.
landscapeboolfalseLandscape orientation.
marginstring20pxUniform page margin, e.g. 10mm, 0px.
print_backgroundbooltrueRender CSS backgrounds.
delayint0Extra wait in ms (max 10000) for JS-heavy pages.
filenamestringdocument.pdfName set in the Content-Disposition header.

GET /credits

Check the balance on the key you call with.

Request
curl https://pdf-hub.net/api/v1/credits \
  -H "Authorization: Bearer ph_live_…"

{"credits": 4988, "key": "ph_live_a1b2c3…"}

Errors

StatusCodeMeaning
401invalid_api_keyMissing, revoked or unknown key.
402quota_exceededMonthly plan limit reached — upgrade from the dashboard.
422conversion_failedThe page could not be rendered. Not charged.
429Rate limit exceeded (120 requests/minute).

Billing

One successful conversion = one unit of your monthly quota; failed conversions are refunded automatically. Quotas reset each month. Plans: Free (250/mo for $0/mo), Starter (5,000/mo for $9/mo), Business (25,000/mo for $29/mo), Scale (100,000/mo for $99/mo).

Get your free API key