Docs / PDF

HTML to PDF API

GET /v1/pdf converts a URL; POST /v1/pdf converts inline HTML. Both return a print-ready PDF. Authenticated and metered.

01

From a URL

terminal
curl -H "Authorization: Bearer $PROOFITO_KEY" \
  "https://api-staging.astraeatech.dev/proofito/v1/pdf?url=https://example.com&format=A4" \
  -o page.pdf
02

From inline HTML

terminal
curl -H "Authorization: Bearer $PROOFITO_KEY" -H "Content-Type: application/json" \
  -d '{"html":"<h1>Invoice #42</h1><p>Thanks for your business.</p>","format":"Letter"}' \
  https://api-staging.astraeatech.dev/proofito/v1/pdf -o invoice.pdf

POST bodies are capped at 256 KB (larger requests get HTTP 413) and must use Content-Type: application/json (else HTTP 415).

03

Options

  • url (GET) / html (POST)required — Absolute http(s) URL, or a non-empty inline HTML string.
  • formatA4 — A4 or Letter (case-insensitive).
  • margin10 — Uniform page margin in millimetres, 0–100.
  • margin_top / margin_right / margin_bottom / margin_left— — Per-side margins in millimetres (0–100 each), each overriding margin for that side.
  • landscapefalse — true/1 prints in landscape orientation.
  • scale1 — Print scale factor, 0.1–2.
  • display_header_footerfalse — Show the header/footer templates on every page (without templates, Chromium's default header/footer prints).
  • header_template / footer_template— — Self-contained HTML for the page header/footer (up to 32768 chars each; require display_header_footer=true; use the date/title/url/pageNumber/totalPages classes to inject print values).
  • print_bgtrue — false/0 drops CSS backgrounds for ink-friendly output.
  • timeout_ms— — Per-request render cap, 1000–60000 ms. Can only tighten the worker default.
  • ttl86400 — Cache freshness in seconds, 0–604800. 0 bypasses the cache.

GET reads options from the query string; POST reads the same names from the JSON body. The header/footer/background options also accept camelCase aliases — displayHeaderFooter, headerTemplate, footerTemplate, printBackground — used only when the snake_case name is absent.

04

Caching and errors

Rendered PDFs are byte-cached like screenshots (X-Cache: HIT/MISS), and cached responses still count as one metered request each. Invalid options return 400, a missing key 401 invalid_api_key, quota exhaustion HTTP 429 — all in the shared JSON envelope. Back to the docs index.