Skip to content

§ The flow

How to convert HTML to PDF with one API call

Three steps: send the page, we render it in managed Chromium, you get the PDF and a timestamped archive back. Here is the whole flow, request to response.

Step 01

Send a URL or raw HTML

Everything is one endpoint. Give it a url and Sitepdf fetches and renders the live page; give it html and it renders your markup directly, which is the usual path for invoices, statements and reports generated from templates.

Layout options travel with the same request: format (A4, Letter, Legal), orientation, margin presets or exact values, and header and footer templates with page numbers. If the page draws content late, set wait_for to a CSS selector and the render holds until it exists.

Request, the call shape early access unlocks
curl https://api.sitepdf.com/v1/render \
  -H "Authorization: Bearer $SITEPDF_KEY" \
  -d url="https://example.com/report/q2" \
  -d format=A4 \
  -d orientation=portrait \
  -d margin=normal \
  -d wait_for="#revenue-chart" \
  -d archive=true

Step 02

We render it in real Chromium

Your page renders in a real, current, managed Chromium, because anything less shows. Engines that support a subset of CSS produce PDFs that almost match the design: flexbox that nearly works, system fonts standing in for your brand font, emoji as empty boxes. The whole point of rendering in the browser engine is that the PDF looks like the page.

  • CSS: grid, flexbox, custom properties, print rules, page-break control.
  • Fonts: your web fonts load and embed; emoji render as emoji.
  • JavaScript: runs by default, with wait_for for charts and async data.
  • Fleet: patched, warmed and scaled by us. You never touch a browser process.

Want to judge output quality right now? The free in-browser converter runs on your own machine, no signup.

Step 03

You get the PDF, plus the archive

The response links your finished document. If the call asked for an archive, it also carries the record: an archive id, the capture timestamp and a retrieval URL that keeps working for the life of your retention window.

Response
{
  "pdf_url": "https://api.sitepdf.com/v1/documents/doc_8f3k2.pdf",
  "pages": 3,
  "rendered_in_ms": 2380,
  "archive": {
    "id": "arc_o2m91",
    "url": "https://example.com/report/q2",
    "captured_at": "2026-07-11T09:14:02Z",
    "retrieve_url": "https://api.sitepdf.com/v1/archives/arc_o2m91"
  }
}

The archive is the half most APIs skip: a timestamped, retrievable snapshot of exactly what was rendered, private to your account. It is what turns "generate a PDF" into "generate a PDF and be able to prove it later". More on website archiving and how archived data is handled.

Where this fits in your stack

Most teams call the render endpoint from a queue worker or a webhook: checkout completes, the invoice HTML renders, the customer gets the PDF, compliance keeps the snapshot. Scheduled jobs cover the record-keeping cases, like saving a page as PDF every week. And if your input is a link rather than markup, the URL to PDF API page covers that path in detail.

The demo on the homepage is the same conversion running fully in your browser, so you can see the output before you ever send us a byte. When you are ready for the API, planned tiers are on the pricing page and early access is free to join.

§ Early access

Get on the early-access list

The API opens to the list first, in order. Early access locks the planned launch rates for 12 months. No card required, launching soon.

Render + archive, one API