Appearance
HTML → PDF (sync)
POST
/v1/utilities/html-pdf
Renders an HTML document (public URL or s3://) to PDF in headless Chromium, with page size, orientation, scale and margins.
Sync: waits for the result and answers 200 with the finished job. A failed run answers with the job and the error's status (422 input rejected by the utility, 502/504 utility failure). If it is still running after 90 s you get 202 + Location and it keeps going — fetch it with getJob. Send Prefer: respond-async to get the async behaviour on this route. Hard limit: 15 min.
Authorizations
apiKey
An API key from the console (API keys). Only its SHA-256 is stored; it is shown once.
Type
HTTP (bearer)
Parameters
Header Parameters
Idempotency-Key
Makes retries safe: re-sending the same key (per API key) returns the original job with Idempotent-Replayed: true instead of running again. Reusing it for a different utility → 409.
Type
string
Max Length
200Prefer
respond-async (RFC 7240) turns this sync route into the async flow (202 + job id).
Type
string
Valid values
"respond-async"Request Body
application/json
JSON "input": { "url": "https://example.com/invoice.html", "pdfOptions": { "format": "A4", "orientation": "portrait", "printBackground": true, "margin": { "top": "12mm", "bottom": "12mm" } } }, "metadata": { "orderId": "ORD-1042" }
{
}
Responses
Finished — the job, with result.files.
application/json
JSON "id": "job_01K7Z3Q4N5P6R7S8T9V0W1X2Y3", "object": "job", "utility": "html-pdf", "mode": "sync", "status": "succeeded", "createdAt": "2026-09-10T17:30:08.412Z", "startedAt": "2026-09-10T17:30:08.412Z", "finishedAt": "2026-09-10T17:30:10.771Z", "timings": { "queueMs": 0, "upstreamMs": 2140, "storageMs": 196, "totalMs": 2359 }, "metadata": { "orderId": "ORD-1042" }, "result": { "files": [ { "url": "https://files.servicelabs.dev/html-pdf/2026-09-10/job_01K7Z3Q4N5P6R7S8T9V0W1X2Y3/20260910173009_22d0cf84ca.pdf", "key": "html-pdf/2026-09-10/job_01K7Z3Q4N5P6R7S8T9V0W1X2Y3/20260910173009_22d0cf84ca.pdf", "name": "20260910173009_22d0cf84ca.pdf", "size": 115741, "contentType": "application/pdf" } ] }, "error": null, "callback": null, "links": { "self": "/v1/jobs/job_01K7Z3Q4N5P6R7S8T9V0W1X2Y3" }
{
}