POST/api/v1/screenshot

Capture HTML as an image

Render a raw HTML string as an image. No public URL needed. Useful for generating OG images, cards, and reports.

Set source=html and pass your HTML in the html parameter. Use POST to avoid query-string length limits. The browser renders the HTML at the given viewport and returns the image.

Parameters

NameTypeRequiredDescription
sourcestringrequiredMust be html.
htmlstringrequiredRaw HTML content to render (max 500 000 chars).
viewport_widthintegeroptionalViewport width in pixels. Default: 1280.

Code Examples

curl -X POST "https://screenshotcore.com/api/v1/screenshot" \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"source":"html","html":"<h1 style=\"font-family:sans-serif;padding:40px\">Hello World</h1>","viewport_width":800}' \
  -o html-shot.png

Response

(Raw PNG bytes, Content-Type: image/png)