Screenshot API Documentation

Complete reference for the Screenshot API

Authentication

All API requests require an API key. You can pass it in three ways:

Authorization: Bearer sk_live_your_key_here
X-API-Key: sk_live_your_key_here
Query: ?api_key=sk_live_your_key_here

Base URL

https://snapapis.com/api

POST /v1/screenshot/capture

Capture a screenshot of a URL. Returns screenshot metadata including a download URL.

Request Body (JSON)

Field Type Required Description
urlstringyesURL to capture (http/https only)
formatstringnoOutput format: png, jpeg, webp, pdf (default: png)
widthintegernoViewport width: 320-3840 (default: 1280)
heightintegernoViewport height: 200-2160 (default: 800)
full_pagebooleannoCapture full scrollable page (default: false)
qualityintegernoImage quality 1-100, jpeg/webp only (default: 90)
delayintegernoDelay in ms before capture, 0-10000 (default: 0)
selectorstringnoCSS selector to capture a specific element
dark_modebooleannoForce dark mode (default: false)
retinabooleanno2x device scale factor (default: false)
transparentbooleannoTransparent background, PNG only (default: false)
hide_adsbooleannoHide common ad elements (default: false)
block_cookie_bannersbooleannoHide cookie/GDPR banners (default: false)
user_agentstringnoCustom User-Agent string
headersobjectnoAdditional HTTP headers as key-value pairs
clipobjectnoCrop region: {x, y, width, height}

Example Request

curl -X POST "https://snapapis.com/api/v1/screenshot/capture" \ -H "Authorization: Bearer sk_live_abc123" \ -H "Content-Type: application/json" \ -d '{ "url": "https://github.com", "format": "png", "width": 1440, "full_page": true, "dark_mode": true }'

Success Response (200)

{
  "success": true,
  "data": {
    "id": 42,
    "url": "https://github.com",
    "format": "png",
    "width": 1440,
    "height": 900,
    "file_size": 284672,
    "duration_ms": 2340,
    "download_url": "https://snapapis.com/api/v1/screenshot/42/download",
    "created_at": "2026-03-15T13:00:00+00:00"
  }
}

Other Endpoints

GET /v1/screenshot/{id}

Get the status and metadata of a screenshot by its ID.

GET /v1/screenshot/{id}/download

Download the screenshot binary (image or PDF).

GET /v1/screenshot/history

Get the last 50 screenshots for this API key.

GET /v1/screenshot/usage

Get usage statistics: total requests, rate limit, remaining quota, success rate.

Error Codes

HTTP Code Description
401MISSING_API_KEYNo API key provided
401INVALID_API_KEYAPI key not found
403API_KEY_INACTIVEKey has been revoked or suspended
403API_KEY_EXPIREDKey has expired
429RATE_LIMIT_EXCEEDEDRate limit reached for this key
422VALIDATION_ERRORInvalid parameters
500SCREENSHOT_FAILEDBrowser failed to capture the page

Code Examples

JavaScript (fetch)

const response = await fetch('https://snapapis.com/api/v1/screenshot/capture', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    url: 'https://example.com',
    format: 'png',
    full_page: true,
  }),
});

const data = await response.json();
console.log(data.data.download_url);

Python (requests)

import requests

response = requests.post(
    'https://snapapis.com/api/v1/screenshot/capture',
    headers={'Authorization': f'Bearer {API_KEY}'},
    json={
        'url': 'https://example.com',
        'format': 'png',
        'full_page': True,
    }
)

data = response.json()
print(data['data']['download_url'])

PHP (Guzzle)

$client = new \GuzzleHttp\Client();

$response = $client->post('https://snapapis.com/api/v1/screenshot/capture', [
    'headers' => ['Authorization' => 'Bearer ' . $apiKey],
    'json' => [
        'url' => 'https://example.com',
        'format' => 'png',
        'full_page' => true,
    ],
]);

$data = json_decode($response->getBody(), true);
echo $data['data']['download_url'];