API Documentation
Welcome to ScreenshotAPI docs. This guide will help you integrate screenshot capture into your application.
Base URL: https://api.screenshotapi.xyz
Quick Start
- Sign up for a free account
- Get your API key from the dashboard
- Make your first API call
curl -X POST https://api.screenshotapi.xyz/v1/capture \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com"}'
Authentication
All API requests require authentication using an API key. Include your API key in the Authorization header.
Authorization: Bearer YOUR_API_KEY
⚠️ Security: Never expose your API key in client-side code. Always make requests from your server.
API Endpoints
/v1/capture
Capture a screenshot of a specified URL.
Request Body:
{
"url": "https://example.com", // Required
"format": "png", // Optional: png, jpg, pdf, webp
"fullPage": false, // Optional: capture full page
"viewport": { // Optional
"width": 1920,
"height": 1080
},
"device": "desktop", // Optional: desktop, mobile, tablet
"cache": "1h", // Optional: cache duration
"waitFor": 1000, // Optional: wait time in ms
"selector": "#main" // Optional: wait for CSS selector
}
Response:
{
"success": true,
"image_url": "https://cdn.screenshotapi.xyz/...",
"cached": false,
"credits_used": 1,
"credits_remaining": 99,
"format": "png",
"size": 245678
}
/v1/keys/stats
Get usage statistics for your API key.
Response:
{
"success": true,
"plan": "starter",
"credits_used": 523,
"credits_remaining": 4477,
"credits_limit": 5000,
"last_used": "2025-12-21T10:30:00Z"
}
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| url | string | Yes | The URL to capture |
| format | string | No | Output format: png, jpg, pdf, webp (default: png) |
| fullPage | boolean | No | Capture full scrollable page (default: false) |
| viewport | object | No | Custom viewport dimensions |
| device | string | No | Preset: desktop, mobile, tablet (default: desktop) |
| cache | string | No | Cache duration: 1s, 5m, 1h, 1d (default: 1h) |
| waitFor | number | No | Wait time in milliseconds (max: 10000) |
Code Examples
JavaScript / Node.js
const response = await fetch('https://api.screenshotapi.xyz/v1/capture', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://example.com',
format: 'png',
fullPage: true
})
});
const data = await response.json();
console.log(data.image_url);
Python
import requests
response = requests.post(
'https://api.screenshotapi.xyz/v1/capture',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={
'url': 'https://example.com',
'format': 'png',
'fullPage': True
}
)
data = response.json()
print(data['image_url'])
PHP
$ch = curl_init('https://api.screenshotapi.xyz/v1/capture');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'url' => 'https://example.com',
'format' => 'png'
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$data = json_decode($response, true);
echo $data['image_url'];
Error Handling
The API uses standard HTTP status codes. All error responses include a JSON body with details.
400 Bad Request
Invalid parameters or missing required fields
401 Unauthorized
Invalid or missing API key
402 Payment Required
Credit limit reached, upgrade plan
429 Too Many Requests
Rate limit exceeded
500 Internal Server Error
Server error, try again later
Rate Limits
All plans have rate limits to ensure fair usage:
| Plan | Rate Limit | Monthly Limit |
|---|---|---|
| Free | 10 requests/minute | 100 screenshots |
| Starter | 30 requests/minute | 5,000 screenshots |
| Pro | 100 requests/minute | 50,000 screenshots |
| Agency | 300 requests/minute | 500,000 screenshots |
Need Help?
Can't find what you're looking for? We're here to help!
Contact Support