Use case
HTML to image API
Build the design with the HTML and CSS you already know, send it to Shotfly, and get an image back. It renders in a real browser, so CSS layout and scripts behave the way they do in Chrome, with no headless browser to run yourself.
<main>
<header><div><p>Invoice</p><h1>#1042</h1></div><strong>Example Studio</strong></header>
<dl><div><dt>Billed to</dt><dd>Example Co.</dd></div><div><dt>Issued</dt><dd>1 Dec 2026</dd></div><div><dt>Due</dt><dd>15 Dec 2026</dd></div></dl>
…
</main>
- 01
Send up to 2 MB of markup in the
htmlfield ofPOST /v1/screenshot;cssandjsadd styles or scripts, andwait_for_selectorwaits for content that appears late. - 02
Set the canvas with
viewport_widthandviewport_height(up to 3840 × 2160) anddevice_scale_factorup to 3 for sharp images; capture one element withselector, or the whole document withfull_page. - 03
Get PNG, JPEG, WebP or PDF;
thumbnail_widthresizes the result on our side. - 04
Billed like any screenshot: one credit per successful render, nothing for failed ones. See the parameter reference.
One request.
Every option is a parameter; see the parameter reference.
curl -X POST "https://api.shotfly.dev/v1/screenshot" -H "Authorization: Bearer $SHOTFLY_SECRET_KEY" \
-H "content-type: application/json" \
-d '{"html":"<h1>Invoice #1042</h1><p>Total: $49.00</p>","css":"body{font-family:sans-serif;padding:48px}","viewport_width":1200,"viewport_height":630,"format":"png"}' \
-o invoice.png