Ready-to-copy cURL code for capturing website screenshots, generating PDFs, and processing pages at scale. Uses cURL.
The simplest way to capture a screenshot. Just a URL and your API key.
curl "https://api.screenshotdev.com/v1/screenshot?url=https://example.com&access_key=YOUR_ACCESS_KEY" \
--output screenshot.pngComplete working script with options for viewport, format, full page capture, and error handling.
#!/bin/bash
set -euo pipefail
API_KEY="YOUR_ACCESS_KEY"
BASE="https://api.screenshotdev.com/v1/screenshot"
take_screenshot() {
local url="$1"
local format="${2:-webp}"
local width="${3:-1280}"
local full_page="${4:-false}"
local output="${5:-screenshot.$format}"
local status
status=$(curl -s -w "%{http_code}" -o "$output" \
"$BASE" \
-G \
-d "url=$url" \
-d "access_key=$API_KEY" \
-d "format=$format" \
-d "width=$width" \
-d "full_page=$full_page")
if [ "$status" != "200" ]; then
echo "Screenshot failed (HTTP $status)" >&2
cat "$output" >&2
return 1
fi
echo "Saved $output ($(wc -c < "$output" | tr -d ' ') bytes)"
}
take_screenshot "https://example.com" "webp" 1440 true "screenshot.webp"PDF generation, batch processing, webhooks, CSS/JS injection, and S3 upload.
curl "https://api.screenshotdev.com/v1/pdf" \
-G \
-d "url=https://example.com" \
-d "access_key=YOUR_ACCESS_KEY" \
-d "format=a4" \
-d "landscape=false" \
-d "margin=20px" \
--output page.pdf#!/bin/bash
API_KEY="YOUR_ACCESS_KEY"
urls=(
"https://example.com"
"https://github.com"
"https://news.ycombinator.com"
)
for url in "${urls[@]}"; do
host=$(echo "$url" | sed 's|https\?://||;s|/.*||')
curl -s "https://api.screenshotdev.com/v1/screenshot" \
-G \
-d "url=$url" \
-d "access_key=$API_KEY" \
-d "format=webp" \
--output "$host.webp" &
done
wait
echo "All screenshots saved"curl -X POST "https://api.screenshotdev.com/v1/screenshot" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"access_key": "YOUR_ACCESS_KEY",
"webhook_url": "https://your-app.com/api/webhooks/screenshot",
"format": "webp",
"full_page": true
}'curl "https://api.screenshotdev.com/v1/screenshot" \
-G \
-d "url=https://example.com" \
-d "access_key=YOUR_ACCESS_KEY" \
--data-urlencode "inject_css=body { font-family: 'Inter', sans-serif; } .ad { display: none; }" \
--data-urlencode "inject_js=document.querySelectorAll('[data-cookie-banner]').forEach(el => el.remove())" \
-d "block_ads=true" \
--output clean.webp# 1. Capture
curl -s "https://api.screenshotdev.com/v1/screenshot" \
-G \
-d "url=https://example.com" \
-d "access_key=YOUR_ACCESS_KEY" \
-d "format=webp" \
--output /tmp/screenshot.webp
# 2. Upload to S3
aws s3 cp /tmp/screenshot.webp s3://my-screenshots/captures/example-com.webp \
--content-type image/webpTest the API in the interactive playground — pre-filled with cURL snippets.
Install the HTTP library used in the examples above.
# cURL is pre-installed on macOS, Linux, and Windows 10+Uses cURL. Any HTTP client that supports GET requests will work.
100 free API calls per month. No credit card. First screenshot in under 30 seconds.