How to Capture Webpage Screenshots with an API
Need to turn a URL into an image? Whether you're building social media preview cards, generating PDF reports, monitoring website changes, or creating automated testing screenshots — a screenshot API is the fastest way to do it.
Why Use a Screenshot API?
You could run your own headless browser, but that means managing Chromium installations, handling memory leaks, dealing with timeouts, and scaling infrastructure. A screenshot API handles all of that for you.
Common use cases:
- Social media previews — Generate Open Graph images from any URL
- PDF reports — Convert dashboards or pages to shareable PDFs
- Visual monitoring — Detect when a webpage changes
- Automated testing — Capture screenshots during test runs
- Link previews — Show thumbnail previews in chat apps
- Archiving — Save visual snapshots of web pages over time
Quick Start with cURL
curl -X POST https://api.16761.tech/screenshot \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://github.com"}' \
-o screenshot.png
That's it. One request, one screenshot.
JavaScript / Node.js Example
const response = await fetch('https://api.16761.tech/screenshot', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://github.com',
width: 1280,
height: 800,
fullPage: true
})
});
const buffer = await response.arrayBuffer();
fs.writeFileSync('screenshot.png', Buffer.from(buffer));
Python Example
import requests
response = requests.post('https://api.16761.tech/screenshot',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
json={
'url': 'https://github.com',
'width': 1280,
'fullPage': True
}
)
with open('screenshot.png', 'wb') as f:
f.write(response.content)
Advanced Options
Custom Viewport
Capture at any resolution up to 4K:
{"url": "https://example.com", "width": 1920, "height": 1080}
Mobile Screenshots
{"url": "https://example.com", "width": 375, "height": 812}
Full Page Capture
{"url": "https://example.com", "fullPage": true}
Element Selector
Capture a specific element on the page:
{"url": "https://example.com", "selector": "#main-content"}
JPEG with Quality Control
{"url": "https://example.com", "format": "jpeg", "quality": 85}
Wait for Dynamic Content
{"url": "https://example.com", "delay": 2000}
Pricing
Free tier: 100 screenshots per day. Pro: 5,000/day for $19/month. Enterprise: 50,000/day for $99/month.
Get Free API Key →Also available on RapidAPI. OpenAPI spec.