Rendering

HTML → a fixed-size image

Paint HTML (or a {{ template }} + data) onto an exact width×height canvas. Defaults to 1200×630 @2x — an Open Graph card.

post/api/render/image

Request

  • Base URL: https://snaplab.dev
  • URL: https://snaplab.dev/api/render/image
  • Auth: HTTP bearer

Request body

htmlstring
templatestring

HTML with {{ placeholders }}, substituted from data and HTML-escaped.

dataobject
cssstring
widthinteger
heightinteger
deviceScaleFactornumber
format'png' | 'jpeg' | 'webp'
qualityinteger
googleFontsstring
delayMsinteger
cacheboolean
responseType'binary' | 'json'

Response

The rendered card.

urlstring uri required
idstring required
formatstring required
widthinteger
heightinteger
bytesinteger required
cacheHitboolean
durationMsinteger

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.