arrow_back All endpoints

HTML to Image

POST/api/v1/tools/html-to-image25 credits per callhtmlcssimagerenderog-imagesocial-cardtemplate

Renders markup you pass in - not a URL - using the same browser engine, so grid, flexbox, gradients and web fonts all behave normally. The markup is rendered with no base URL, so images must use absolute https addresses or data URIs. Useful for turning email templates, invoices and social cards into pictures without deploying them.

receipt_long
Why 25 credits?

Identical work to a URL capture: one headless Chromium instance per call.

Any HTTP client works. Replace the key with one from your dashboard.

bash
curl -X POST https://toolkitbackend-j69m.onrender.com/api/v1/tools/html-to-image \
  -H "Authorization: Bearer tb_live_<your_api_key>" \
  -H "Content-Type: application/json" \
  -d '{
  "html": "<div style=\"font:700 64px system-ui;padding:80px\">Launch day</div>",
  "width": 1200,
  "height": 630,
  "fullPage": false,
  "deviceScaleFactor": 1,
  "format": "png",
  "quality": 85
}'

Input

FieldTypeRequiredDefaultDescription
htmlstringrequired- A full document or a bare fragment. Fragments are wrapped for you.
widthintegeroptional1440 Canvas width in CSS pixels; this is the viewport your CSS lays out against.
heightintegeroptional900 Canvas height in CSS pixels. Ignored when fullPage is true.
fullPagebooleanoptionalfalse Capture the whole document rather than one canvas-sized frame.
deviceScaleFactorintegeroptional1 1 for standard density, 2 for a Retina render.
formatstringoptionalpng png or jpeg. Defaults to png.
qualityintegeroptional85 JPEG quality, 40-100. Ignored for png.

Output

FieldTypeDescription
fileBase64stringRendered image, base64-encoded, without a data URI prefix.
mimeTypestringimage/png or image/jpeg.
widthintegerPixel width of the returned image.
heightintegerPixel height of the returned image.
truncatedbooleanTrue when a very tall document was clipped to the height ceiling.

Try it

Sends a real POST /api/v1/tools/html-to-image from your browser and charges 25 credits to your account.

Sign in to run this endpoint. New accounts start with free credits.