Render a URL or HTML (query form)
Every option as a query parameter, so a render can sit in an <img src>. Accepts a bearer key or a signed URL (keyId + sig).
Request
- Base URL: https://snaplab.dev
- URL: https://snaplab.dev/api/render
- Auth: one of:
- HTTP bearer
- API key in query parameter keyId and API key in query parameter sig
Query parameters
Absolute http(s) URL. Provide this or html/template.
URL-encoded HTML to render instead of navigating.
URL-encoded {{ template }} HTML.
JSON object (URL-encoded) with values for the template.
URL-encoded stylesheet injected into <head>.
Comma-separated font families.
Output format.
Viewport preset.
Viewport width in CSS pixels.
Viewport height in CSS pixels.
Pixel ratio (0.5–3).
Sugar for viewport=mobile.
Capture the whole scrollable page.
Capture just this element.
1–100, jpeg/webp/avif only.
Navigation wait condition. Default "auto": waits for load, then for the network to be quiet for 150ms, capped at 400ms. "networkidle" is the full wait and costs ~0.5s more.
Wait for this selector before capturing.
Extra settle time, 0–30000.
Scroll down first, to trigger lazy loading.
Comma-separated selectors to hide.
true/force emulate prefers-color-scheme: dark AND turn on Chromium's auto dark mode, so a site with no dark theme still comes back dark (a site that has one is left alone). prefers is the media query only.
Hide known cookie/consent banners (default true).
Abort ad/analytics/session-replay requests.
URL-encoded CSS injected after load.
URL-encoded JS evaluated after load.
Set false to force a fresh render.
json answers with a hosted URL instead of bytes.
Paper size. Flat alias: pdfFormat.
Landscape orientation. Flat alias: pdfLandscape.
Print background graphics. Flat alias: pdfPrintBackground.
0.1–2. Flat alias: pdfScale.
Honour the page's @page size. Flat alias: pdfPreferCSSPageSize.
One CSS length applied to all four sides. Per-side: pdf.margin.top … or pdfMarginTop ….
HTML drawn at the top of every page. Flat alias: pdfHeaderTemplate.
HTML drawn at the bottom of every page, or a preset name (@pageNumbers, @pageNumbersUrl). Setting it turns displayHeaderFooter on. Flat alias: pdfFooterTemplate.
Draw the running header/footer. Inferred from the templates. Flat alias: pdfDisplayHeaderFooter.
Sheets to keep — 1-3, 1,4,7-9. Flat alias: pdfPageRanges.
Stylesheet the paper is printed under. Default print. Case-insensitive. Flat alias: pdfMedia.
Emit a tagged (accessible) PDF. Flat alias: pdfTagged.
Embed a document outline (bookmarks). Flat alias: pdfOutline.
Exact paper width as a CSS length; replaces pdf.format and needs pdf.height too. Flat alias: pdfWidth.
Exact paper height as a CSS length. Flat alias: pdfHeight.
Drop background colours and images. Flat alias: pdfOmitBackground.
Suggested download name, sanitised — sets content-disposition on the response.
API key id, for a signed URL. Send with sig.
hex(HMAC_SHA256(signingSecret, canonicalQuery)) over every pair except sig, sorted by name then value.
Optional Unix-seconds expiry, included in the signed canonical string.
Response
The rendered bytes.
Example response
{
"url": "https://snaplab.dev/i/c/V1StGXR8_Z5j",
"id": "V1StGXR8_Z5j",
"format": "png"
}Changes
No recorded changes to this operation across all 1 revision of this API.