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
| Parameter | Type | Default | Description |
|---|---|---|---|
url required | string | — | The URL to screenshot. Must be a public URL. |
format optional | string | png | Output format: png, jpg, webp, pdf |
width optional | integer | 1280 | Viewport width in px. Range: 320–3840. |
height optional | integer | 800 | Viewport height in px. Range: 200–2160. |
full_page optional | boolean | false | Capture the full scrollable page, not just the viewport. |
dark_mode optional | boolean | false | Render the page with prefers-color-scheme: dark. |
Response headers
| Header | Description |
|---|---|
Content-Type | image/png, image/jpeg, image/webp, or application/pdf |
X-Credits-Used | Credits used this month |
X-Credits-Remaining | Credits 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 field | Type | Description |
|---|---|---|
email required | string | Your email address. We'll send your API key here. |
{
"api_key": "snap_abc123...",
"plan": "free",
"credits": 1,
"message": "Welcome to SnapAPI!"
}
Output Formats
| Format | MIME type | Best for |
|---|---|---|
png | image/png | High quality, lossless. Default. |
jpg | image/jpeg | Smaller file size, slight quality loss. |
webp | image/webp | Best size/quality ratio for web. |
pdf | application/pdf | Document export, print-ready. |
Errors
| Status | Error | Meaning |
|---|---|---|
| 401 | Missing API key | No x-api-key header provided. |
| 401 | Invalid API key | Key not found in the system. |
| 400 | url param required | Missing url parameter. |
| 400 | Invalid URL | URL is malformed or targets a private IP. |
| 429 | Monthly limit reached | You've used all credits for this month. Upgrade to continue. |
| 429 | Rate limit exceeded | Too many requests per minute. |
| 500 | Screenshot failed | The browser couldn't render the page. |
Rate Limits
| Endpoint | Limit |
|---|---|
| GET /screenshot | 60 requests / minute per IP |
| POST /register | 5 requests / hour per IP |
| All endpoints | 200 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)