Whether you're building a link preview feature, monitoring competitor websites, generating thumbnails for a content aggregator, or archiving web pages - a website screenshot API lets you capture any URL as an image or PDF with a single HTTP request.
This guide covers everything you need to know to get started.
What Is a Screenshot API?
A screenshot API is a service that accepts a URL (or raw HTML) and returns a rendered image or PDF. Under the hood it runs a headless browser - typically Chromium via Playwright or Puppeteer - so the result looks exactly like what a user would see in their browser, including JavaScript-rendered content.
Basic Screenshot in 30 Seconds
Node.js
const axios = require('axios');
const fs = require('fs');
const response = await axios.get('https://api.screenshotcore.com/v1/screenshot', {
headers: { Authorization: 'Bearer YOUR_API_KEY' },
params: { url: 'https://github.com' },
responseType: 'arraybuffer',
});
fs.writeFileSync('github.png', response.data);
console.log('Screenshot saved!');
Python
import requests
response = requests.get(
"https://api.screenshotcore.com/v1/screenshot",
headers={"Authorization": "Bearer YOUR_API_KEY"},
params={"url": "https://github.com"},
)
response.raise_for_status()
with open("github.png", "wb") as f:
f.write(response.content)
PHP
$response = \Illuminate\Support\Facades\Http::withToken('YOUR_API_KEY')
->get('https://api.screenshotcore.com/v1/screenshot', [
'url' => 'https://github.com',
]);
file_put_contents('github.png', $response->body());
cURL
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://api.screenshotcore.com/v1/screenshot?url=https://github.com" \
-o github.png
Capturing a Full-Page Screenshot
By default most APIs capture only the visible viewport. Pass full_page=true to scroll and capture the entire page height:
params: {
url: 'https://stripe.com',
full_page: true,
width: 1440, // desktop viewport
}
Mobile Screenshots
Simulate an iPhone or Android viewport to get mobile-optimized screenshots:
params: {
url: 'https://stripe.com',
width: 390, // iPhone 14 Pro
height: 844,
device_scale_factor: 3, // retina
is_mobile: true,
user_agent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15',
}
PDF Output
Switch format to pdf to get a print-quality PDF instead of an image:
params: {
url: 'https://yourapp.com/reports/q1-2026',
format: 'pdf',
full_page: true,
}
Capturing JavaScript-Heavy Pages
Single-page applications (React, Vue, Angular) render content after the initial HTML load. Use wait_until to tell the API to wait for the page to fully load:
params: {
url: 'https://react-app.example.com/dashboard',
wait_until: 'networkidle', // wait for no network activity for 500ms
delay: 2000, // optional extra delay in ms
}
Screenshot of a Specific Element
Crop to a specific CSS selector to screenshot just a chart, card, or widget:
params: {
url: 'https://example.com/analytics',
selector: '#revenue-chart',
}
Using Raw HTML Instead of a URL
You don't need a live URL. You can pass raw HTML directly - useful for generating images from templates:
params: {
html: '<h1 style="font-family:sans-serif;padding:40px">Hello World</h1>',
width: 800,
height: 200,
}
Common Use Cases
- Link previews - generate thumbnail images when users paste URLs in your app (like Notion, Slack, or Linear).
- OG images - automatically generate Open Graph images for blog posts and product pages.
- Website monitoring - capture periodic screenshots to detect visual regressions or unexpected changes.
- PDF exports - let users export invoices, reports, or dashboards as PDFs from your SaaS.
- Thumbnails for aggregators - generate preview images for bookmark managers, content curators, or news apps.
- Social media automation - capture website content as images for social media posts.
Choosing an API
When evaluating screenshot APIs, look for:
- Chromium-based rendering - the only way to guarantee accurate, modern CSS rendering.
- Full-page support - not all APIs scroll the page correctly.
- Raw HTML input - essential for template-based generation.
- Reasonable latency - under 3 seconds for standard screenshots.
- Transparent pricing - pay per request, not per seat.
ScreenshotCore checks all of these boxes. Try it free - 100 screenshots per month, no credit card required.
