Source Types

Capture from a live URL, raw HTML string, or Markdown, controlled by the source parameter.

The source parameter controls what the browser renders:

  • url (default): Navigate to a public URL.
  • html: Render a raw HTML string you provide in the html parameter. No network request is made.
  • markdown: Render a Markdown string (provided in the markdown parameter) converted to HTML. Useful for generating preview images from docs or README files.

Parameters

NameTypeRequiredDescription
sourcestringoptionalWhat to render: url (default), html, or markdown.
urlstringoptionalRequired when source=url. The page URL to capture (max 2048 chars).
htmlstringoptionalRequired when source=html. Raw HTML content to render (max 500 000 chars).
markdownstringoptionalRequired when source=markdown. Markdown content to convert and render (max 500 000 chars).

Code Examples

# Render raw HTML
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=\"padding:40px\">Hello World</h1>","viewport_width":800}' \
  -o html-shot.png

# Render Markdown
curl -X POST "https://screenshotcore.com/api/v1/screenshot" \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"source":"markdown","markdown":"# Hello\n\n> This is a blockquote","viewport_width":800}' \
  -o md-shot.png

Response

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