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
htmlparameter. No network request is made. - markdown: Render a Markdown string (provided in the
markdownparameter) converted to HTML. Useful for generating preview images from docs or README files.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
source | string | optional | What to render: url (default), html, or markdown. |
url | string | optional | Required when source=url. The page URL to capture (max 2048 chars). |
html | string | optional | Required when source=html. Raw HTML content to render (max 500 000 chars). |
markdown | string | optional | Required 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.pngResponse
(Raw PNG bytes, Content-Type: image/png)