Optimized: 18-20 Second Google Apps Script Support

Important: All API endpoints require authentication with an API key, including the free tier. No requests work without authentication. Sign up for free to get your API key.

API Documentation

Professional screenshot and PDF generation API with advanced features and lightning-fast Google Apps Script support

Base URL

https://snapshotapi.in

Authentication

All API endpoints require authentication using your API key, including the free tier. You can obtain your API key from the dashboard after signing up.

Getting Your API Key

  1. Sign up or log in to your account
  2. Go to your dashboard
  3. Copy your API key from the API Keys section
  4. Use it in your requests as shown below

Authentication Methods

You can authenticate in three ways:

# 1. Query parameter (recommended for testing)
GET /api/screenshot?api_key=YOUR_API_KEY&url=https://example.com

# 2. Authorization header
GET /api/screenshot?url=https://example.com
Authorization: Bearer YOUR_API_KEY

# 3. Custom header
GET /api/screenshot?url=https://example.com
X-API-Key: YOUR_API_KEY

Free Tier

SnapshotAPI offers a free tier with the following limits:

Free tier users get the exact same API access and features as paid users, just with usage limits. Upgrade anytime for higher limits.

Screenshot Endpoints

GET /api/screenshot

Generate a screenshot of any website with advanced targeting and customization options. Supports both session-based and API key authentication.

Parameters

Parameter Type Required Description
url string Required The URL of the website to screenshot
format string Optional Output format: png, jpeg, jpg, webp (default: png)
width number Optional Viewport width in pixels (default: 1920)
height number Optional Viewport height in pixels (default: 1080)
fullPage boolean Optional Capture full page screenshot (default: false)
delay number Optional Delay in milliseconds before capture (default: 0)
quality number Optional JPEG quality 1-100 (default: 80)
element string Optional CSS selector for specific element to capture
selector string Optional Alternative to 'element' - CSS selector for specific element to capture
mobile boolean Optional Enable mobile device emulation (default: false)
dark boolean Optional Enable dark mode emulation (default: false)
cache boolean Optional Enable caching (default: true)
cropX number Optional X coordinate for cropping (pixels)
cropY number Optional Y coordinate for cropping (pixels)
cropWidth number Optional Width for cropping (pixels)
cropHeight number Optional Height for cropping (pixels)
hideElements string Optional CSS selectors to hide (comma-separated)
waitForSelector string Optional CSS selector to wait for before screenshot
googleAppsScript boolean Optional Enable Google Apps Script mode (default: auto-detect)
removeBanners boolean Optional Remove notification banners (default: true)
bannerSelectors string Optional Custom CSS selectors for banners to remove (comma-separated)
device string Optional Device type: "mobile", "tablet" (default: desktop)
wait number Optional Wait time in milliseconds before capture
GET /api/v1/screenshot

Alternative screenshot endpoint with strict API key authentication only (session-based authentication is not supported on this endpoint). This endpoint uses the exact same parameters as /api/screenshot shown above. Recommended for programmatic access from external applications.

Authentication

This endpoint requires API key authentication via one of these methods:

  • Query parameter: ?api_key=YOUR_API_KEY
  • Authorization header: Authorization: Bearer YOUR_API_KEY
  • Custom header: X-API-Key: YOUR_API_KEY

Note: All parameters from the /api/screenshot endpoint above apply to this endpoint as well.

PDF Endpoint

GET /api/pdf

Convert any webpage to a high-quality PDF document.

Parameters

Parameter Type Required Description
url string Required The URL of the website to convert to PDF
format string Optional Paper format: A4, Letter, etc (default: A4)
margin string Optional Margin size in pixels (default: 0)
landscape boolean Optional Enable landscape orientation (default: false)
printBackground boolean Optional Print background graphics (default: true)

Examples

Basic Screenshot
curl "https://snapshotapi.in/api/screenshot?api_key=YOUR_API_KEY&url=https://example.com"
Using Authorization Header
curl -H "Authorization: Bearer YOUR_API_KEY" "https://snapshotapi.in/api/screenshot?url=https://example.com"
V1 Endpoint (Recommended)
curl "https://snapshotapi.in/api/v1/screenshot?api_key=YOUR_API_KEY&url=https://example.com"
Google Apps Script Screenshot (Optimized)
curl "https://snapshotapi.in/api/screenshot?api_key=YOUR_API_KEY&url=https://script.google.com/macros/s/YOUR_SCRIPT_ID/exec&googleAppsScript=true"
Full Page Mobile Screenshot
curl "https://snapshotapi.in/api/screenshot?api_key=YOUR_API_KEY&url=https://example.com&fullPage=true&mobile=true"
Advanced Options with Multiple Parameters
curl "https://snapshotapi.in/api/screenshot?api_key=YOUR_API_KEY&url=https://example.com&width=1920&height=1080&fullPage=true&format=png&quality=90&delay=2000&removeBanners=true&mobile=false"
Element Screenshot with Cropping
curl "https://snapshotapi.in/api/screenshot?url=https://example.com&element=.header&cropX=0&cropY=0&cropWidth=800&cropHeight=200"
JavaScript Example
// Replace YOUR_API_KEY with your actual API key from dashboard
const API_KEY = 'YOUR_API_KEY';

// Basic screenshot
const basicUrl = `https://snapshotapi.in/api/screenshot?api_key=${API_KEY}&url=https://example.com`;

// Advanced screenshot with all options
const params = new URLSearchParams({
    api_key: API_KEY,
    url: 'https://example.com',
    format: 'png',
    width: 1920,
    height: 1080,
    fullPage: true,
    delay: 2000,
    quality: 90,
    removeBanners: true,
    mobile: false,
    dark: false,
    cache: true
});

const advancedUrl = `https://snapshotapi.in/api/screenshot?${params}`;

// Using fetch with Authorization header
fetch('https://snapshotapi.in/api/screenshot?url=https://example.com', {
    headers: {
        'Authorization': `Bearer ${API_KEY}`
    }
}).then(response => response.blob())
  .then(blob => {
    const imageUrl = URL.createObjectURL(blob);
    document.getElementById('screenshot').src = imageUrl;
  });
Python Example
import requests

# Replace with your actual API key from dashboard
API_KEY = 'YOUR_API_KEY'

# Method 1: Using query parameter
response = requests.get('https://snapshotapi.in/api/screenshot', params={
    'api_key': API_KEY,
    'url': 'https://example.com',
    'format': 'png',
    'width': 1920,
    'height': 1080,
    'fullPage': True,
    'removeBanners': True
})

# Method 2: Using Authorization header (recommended)
headers = {'Authorization': f'Bearer {API_KEY}'}
response = requests.get('https://snapshotapi.in/api/screenshot',
                       headers=headers,
                       params={
                           'url': 'https://example.com',
                           'format': 'png',
                           'fullPage': True
                       })

# Method 3: Advanced options
response = requests.get('https://snapshotapi.in/api/screenshot', params={
    'api_key': API_KEY,
    'url': 'https://example.com',
    'width': 1920,
    'height': 1080,
    'fullPage': True,
    'format': 'png',
    'quality': 90,
    'delay': 2000,
    'removeBanners': True,
    'mobile': False,
    'dark': False,
    'cache': True
})

# Check for errors
if response.status_code == 401:
    print('Authentication failed. Check your API key.')
elif response.status_code == 429:
    print('Rate limit exceeded. Please wait before making more requests.')
elif response.status_code == 200:
    # Save to file
    with open('screenshot.png', 'wb') as f:
        f.write(response.content)
    print('Screenshot saved successfully!')
else:
    print(f'Error: {response.status_code}')

Key Features

Lightning Fast

Google Apps Script support optimized from 5+ minutes to just 18-20 seconds

Element Targeting

Capture specific elements using CSS selectors

Pixel Perfect Cropping

Extract exact regions with X,Y coordinates

Banner Removal

Automatically remove cookie notices and popups

Device Emulation

Perfect mobile and tablet screenshots

Dark Mode

Capture sites in dark mode automatically

Response

The API returns the image binary data directly with appropriate content-type headers. You can use the URL directly in img tags or download the image.

Response Headers

Content-Type: image/png (or image/jpeg, image/webp)
Content-Length: [size in bytes]
Cache-Control: public, max-age=3600 (if cache enabled)
X-Processing-Time: [time in ms]
X-Google-Apps-Script: true (if GAS detected)
X-Rate-Limit-Remaining: 95
X-Rate-Limit-Reset: 1706702400

Error Handling

The API returns appropriate HTTP status codes with JSON error details. Common errors:

Authentication Errors

// 401 - No API key provided
{
    "error": "Authentication required",
    "code": "AUTH_REQUIRED",
    "message": "API key is required. Please sign up or log in to get your API key."
}

// 401 - Invalid API key
{
    "error": "Invalid API key",
    "code": "INVALID_API_KEY"
}

Usage Limit Errors

// 429 - Usage limit exceeded
{
    "error": "Usage limit exceeded",
    "code": "USAGE_LIMIT_EXCEEDED",
    "message": "Monthly limit of 100 requests exceeded",
    "usage": {
        "current": 100,
        "limit": 100,
        "resetDate": "2025-02-01T00:00:00.000Z"
    }
}

// 429 - Rate limit exceeded
{
    "error": "Rate limit exceeded",
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit of 10 requests per minute exceeded",
    "retryAfter": 60
}

Subscription Errors

// 402 - Subscription required
{
    "error": "Subscription required",
    "code": "SUBSCRIPTION_REQUIRED",
    "message": "Your subscription is not active. Please update your payment method."
}

// 403 - Plan upgrade required
{
    "error": "Upgrade required",
    "code": "PLAN_UPGRADE_REQUIRED",
    "message": "This feature requires professional plan or higher",
    "currentPlan": "starter",
    "requiredPlan": "professional"
}

General Errors

// 400 - Bad request
{
    "error": "Invalid URL",
    "message": "Please provide a valid URL",
    "timestamp": "2025-01-30T12:00:00.000Z"
}

// 500 - Server error
{
    "error": "Failed to take screenshot",
    "message": "Internal server error",
    "timestamp": "2025-01-30T12:00:00.000Z",
    "processingTime": "1234ms"
}