website-screenshot
Website Screenshot API
Capture screenshots of any live website via html2png.dev.
Endpoint
POST https://html2png.dev/api/screenshot
Request
curl -X POST "https://html2png.dev/api/screenshot" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "width": 1280, "fullPage": true}'
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
url |
string | required | Website URL to capture |
width |
int | 1280 | Viewport width |
height |
int | 800 | Viewport height |
fullPage |
bool | false | Capture entire scrollable page |
format |
string | png | png, webp, pdf |
deviceScaleFactor |
float | 2 | Retina scale (1-4) |
delay |
int | 0 | Wait ms before capture |
omitBackground |
bool | false | Transparent bg |
colorScheme |
string | - | light or dark |
userAgent |
string | - | Custom user agent |
Response
{
"success": true,
"url": "https://html2png.dev/api/blob/screenshot-abc.png",
"format": "png",
"timestamp": "2025-01-27T10:30:00.000Z"
}
Examples
Basic Screenshot
curl -X POST "https://html2png.dev/api/screenshot" \
-H "Content-Type: application/json" \
-d '{"url": "https://github.com"}'
Full Page Capture
curl -X POST "https://html2png.dev/api/screenshot" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "fullPage": true, "delay": 2000}'
Mobile Viewport
curl -X POST "https://html2png.dev/api/screenshot" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "width": 375, "height": 812, "deviceScaleFactor": 3}'
PDF Export
curl -X POST "https://html2png.dev/api/screenshot" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "format": "pdf", "fullPage": true}'
Dark Mode
curl -X POST "https://html2png.dev/api/screenshot" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "colorScheme": "dark"}'
JavaScript Example
const response = await fetch("https://html2png.dev/api/screenshot", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
url: "https://example.com",
width: 1280,
fullPage: true,
delay: 1000,
}),
});
const data = await response.json();
console.log(data.url);
Tips
- Use
delayfor sites with heavy JavaScript or animations fullPagecaptures the entire scrollable contentdeviceScaleFactor=2or higher for crisp text- No caching - each request captures fresh content
Rate Limits
50 requests/hour per IP.
More from html2png/skills
html-to-image
Generate crisp, high-quality images with perfect typography and precise geometric layouts using HTML/CSS. Use when creating social cards, diagrams, certificates, UI mockups, code screenshots, or any image requiring sharp text rendering, exact alignment, or vector-like precision. AI excels at designing symmetric, pixel-perfect layouts as HTML rather than generating raster images directly. Supports Tailwind CSS, Google Fonts, icon libraries, and any web-based design resource.
111og-image
Generate Open Graph (OG) images and social media preview cards for websites, blog posts, and products. Use when creating social share images, Twitter/X cards, LinkedIn post images, or any visual preview that appears when sharing links on social platforms. Produces properly sized images (1200x630, 1200x675, etc.) with crisp typography and professional layouts.
18code-to-image
Generate beautiful code snippet images with syntax highlighting. Use when users want to share code as an image, create code screenshots for social media, documentation, or presentations. Produces crisp, syntax-highlighted code with customizable themes, window chrome, and professional styling.
13