API Reference

Everything you need to start taking screenshots programmatically.

Introduction

SnapAPI is a REST API that renders any public URL in a real Chromium browser and returns the result as an image or PDF. No browser to install, no Puppeteer to maintain.

Base URL: https://api.snappapi.dev

All responses are either raw image bytes (on success) or a JSON error object.

Authentication

Pass your API key in the x-api-key request header.

http
GET /screenshot?url=https://example.com
x-api-key: snap_your_api_key_here

Get your free API key at snapapi-landing.netlify.app.

Quick Start

curl
# Basic PNG screenshot
curl "https://api.snappapi.dev/screenshot?url=https://example.com" \
  -H "x-api-key: YOUR_KEY" \
  --output screenshot.png

GET /screenshot

Renders a URL and returns the image or PDF as a binary response.

GET/screenshot

Parameters

ParameterTypeDefaultDescription
url requiredstringThe URL to screenshot. Must be a public URL.
format optionalstringpngOutput format: png, jpg, webp, pdf
width optionalinteger1280Viewport width in px. Range: 320–3840.
height optionalinteger800Viewport height in px. Range: 200–2160.
full_page optionalbooleanfalseCapture the full scrollable page, not just the viewport.
dark_mode optionalbooleanfalseRender the page with prefers-color-scheme: dark.

Response headers

HeaderDescription
Content-Typeimage/png, image/jpeg, image/webp, or application/pdf
X-Credits-UsedCredits used this month
X-Credits-RemainingCredits remaining this month

Examples

examples
# Full-page WebP
/screenshot?url=https://github.com&format=webp&full_page=true

# PDF export
/screenshot?url=https://myapp.com/invoice/123&format=pdf

# Mobile viewport
/screenshot?url=https://example.com&width=390&height=844

# Dark mode
/screenshot?url=https://example.com&dark_mode=true

GET /me

Returns your account info and current usage.

GET/me
{ "email": "[email protected]", "plan": "starter", "credits_used": 42, "credits_limit": 100, "credits_remaining": 58 }

POST /register

Create an account and get an API key.

POST/register
Body fieldTypeDescription
email requiredstringYour email address. We'll send your API key here.
{ "api_key": "snap_abc123...", "plan": "free", "credits": 1, "message": "Welcome to SnapAPI!" }

Output Formats

FormatMIME typeBest for
pngimage/pngHigh quality, lossless. Default.
jpgimage/jpegSmaller file size, slight quality loss.
webpimage/webpBest size/quality ratio for web.
pdfapplication/pdfDocument export, print-ready.

Errors

StatusErrorMeaning
401Missing API keyNo x-api-key header provided.
401Invalid API keyKey not found in the system.
400url param requiredMissing url parameter.
400Invalid URLURL is malformed or targets a private IP.
429Monthly limit reachedYou've used all credits for this month. Upgrade to continue.
429Rate limit exceededToo many requests per minute.
500Screenshot failedThe browser couldn't render the page.

Rate Limits

EndpointLimit
GET /screenshot60 requests / minute per IP
POST /register5 requests / hour per IP
All endpoints200 requests / minute per IP (global)

On top of rate limits, each plan has a monthly credit cap that resets on the 1st of each month.

curl

curl
# PNG screenshot
curl "https://api.snappapi.dev/screenshot?url=https://example.com&format=png" \
  -H "x-api-key: YOUR_KEY" --output out.png

# Full-page PDF
curl "https://api.snappapi.dev/screenshot?url=https://example.com&format=pdf&full_page=true" \
  -H "x-api-key: YOUR_KEY" --output out.pdf

JavaScript

javascript
const res = await fetch(
  'https://api.snappapi.dev/screenshot?url=https://example.com&format=png',
  { headers: { 'x-api-key': 'YOUR_KEY' } }
);
const buffer = await res.arrayBuffer();
fs.writeFileSync('screenshot.png', Buffer.from(buffer));

Python

python
import requests

res = requests.get(
    'https://api.snappapi.dev/screenshot',
    params={'url': 'https://example.com', 'format': 'png'},
    headers={'x-api-key': 'YOUR_KEY'}
)
with open('screenshot.png', 'wb') as f:
    f.write(res.content)