How to Take Website Screenshots with an API

Updated May 2026 · 5 min read

Need to capture website screenshots automatically? Whether you're building link previews, archiving pages, or generating thumbnails, a screenshot API is the fastest way to do it. This guide shows you how, with code examples in cURL, JavaScript, and Python.

Contents

  1. Why use a screenshot API?
  2. Getting started (2 minutes)
  3. Basic screenshot
  4. Customization options
  5. Code examples
  6. Advanced: metadata + PDF

Why Use a Screenshot API?

Running your own headless browser (Puppeteer/Playwright) works for small-scale use, but it comes with overhead:

A screenshot API handles all of this. You send a URL, you get back an image. Simple.

Step 1: Get an API Key

Free tier: 50 requests/month, no credit card required.
curl -X POST https://snap.michaelcli.com/api/signup \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "name": "My App"}'

Response:

{
  "key": "snap_abc123...",
  "tier": "free",
  "message": "API key created. 50 free requests/month."
}

Step 2: Take a Screenshot

curl -X POST https://snap.michaelcli.com/api/screenshot \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://github.com"}' \
  --output screenshot.png

That's it. You'll get a PNG screenshot of the page.

Step 3: Customize

Control the viewport, format, and capture behavior:

curl -X POST https://snap.michaelcli.com/api/screenshot \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "width": 1920,
    "height": 1080,
    "full_page": true,
    "format": "jpeg",
    "quality": 80
  }' \
  --output full-page.jpg
ParameterDefaultDescription
width1280Viewport width in pixels
height720Viewport height in pixels
full_pagefalseCapture entire scrollable page
formatpngpng or jpeg
quality80JPEG quality (1-100)

Code Examples

JavaScript (Node.js)

const fs = require('fs');

const res = await fetch('https://snap.michaelcli.com/api/screenshot', {
  method: 'POST',
  headers: {
    'X-API-Key': 'YOUR_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ url: 'https://github.com', width: 1280 })
});

const buffer = Buffer.from(await res.arrayBuffer());
fs.writeFileSync('screenshot.png', buffer);

Python

import requests

response = requests.post(
    'https://snap.michaelcli.com/api/screenshot',
    headers={'X-API-Key': 'YOUR_KEY'},
    json={'url': 'https://github.com', 'width': 1280}
)

with open('screenshot.png', 'wb') as f:
    f.write(response.content)

Bonus: Metadata + PDF

SnapAPI also extracts metadata and generates PDFs from the same API:

Extract Open Graph / Meta Tags

curl -X POST https://snap.michaelcli.com/api/metadata \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://github.com"}'

Generate PDF

curl -X POST https://snap.michaelcli.com/api/pdf \
  -H "X-API-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "format": "A4"}' \
  --output page.pdf

Ready to Start?

50 free requests/month. No credit card. Set up in 30 seconds.

Get Free API Key

Use code LAUNCH50 for 50% off paid plans