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 |
|---|---|---|---|
url | string | yes | URL to capture (http/https only) |
format | string | no | Output format: png, jpeg, webp, pdf (default: png) |
width | integer | no | Viewport width: 320-3840 (default: 1280) |
height | integer | no | Viewport height: 200-2160 (default: 800) |
full_page | boolean | no | Capture full scrollable page (default: false) |
quality | integer | no | Image quality 1-100, jpeg/webp only (default: 90) |
delay | integer | no | Delay in ms before capture, 0-10000 (default: 0) |
selector | string | no | CSS selector to capture a specific element |
dark_mode | boolean | no | Force dark mode (default: false) |
retina | boolean | no | 2x device scale factor (default: false) |
transparent | boolean | no | Transparent background, PNG only (default: false) |
hide_ads | boolean | no | Hide common ad elements (default: false) |
block_cookie_banners | boolean | no | Hide cookie/GDPR banners (default: false) |
user_agent | string | no | Custom User-Agent string |
headers | object | no | Additional HTTP headers as key-value pairs |
clip | object | no | Crop 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 |
|---|---|---|
| 401 | MISSING_API_KEY | No API key provided |
| 401 | INVALID_API_KEY | API key not found |
| 403 | API_KEY_INACTIVE | Key has been revoked or suspended |
| 403 | API_KEY_EXPIRED | Key has expired |
| 429 | RATE_LIMIT_EXCEEDED | Rate limit reached for this key |
| 422 | VALIDATION_ERROR | Invalid parameters |
| 500 | SCREENSHOT_FAILED | Browser 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'];