Everything you need to integrate the Screenshot API into your application
All API requests require an API key passed in the x-api-key header.
Demo API Key
Use ek_live_74qlNSbK5jTwq28Y for testing. This key has free tier limits (10 requests/minute, 100/month).
https://screenshot.endpnt.dev/api/v1/capturehttps://screenshot.endpnt.dev/api/v1/capture?url=...Both GET and POST methods are supported. For POST requests, send parameters in the request body as JSON. For GET requests, send parameters as URL query parameters.
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | Yes | — | URL to screenshot. Must be valid http:// or https:// |
format | string | No | png | Output format: "png", "jpeg", "pdf" |
width | number | No | 1280 | Viewport width in pixels (320-3840) |
height | number | No | 720 | Viewport height in pixels (320-2160) |
full_page | boolean | No | false | Capture entire scrollable page |
wait_for | number | No | 0 | Milliseconds to wait after load (max: 10000) |
selector | string | No | — | CSS selector to capture specific element |
quality | number | No | 80 | JPEG quality (1-100) |
dark_mode | boolean | No | false | Emulate dark color scheme preference |
device | string | No | desktop | Device preset: "desktop", "mobile", "tablet" |
{
"success": true,
"data": {
"image": "base64_encoded_image_data...",
"width": 1280,
"height": 720,
"format": "png",
"file_size_bytes": 284720
},
"meta": {
"request_id": "req_a1b2c3d4",
"processing_ms": 1840,
"remaining_credits": 99
}
}{
"success": false,
"error": {
"code": "INVALID_URL",
"message": "The provided URL is not valid. Must be http:// or https://"
},
"meta": {
"request_id": "req_a1b2c3d4",
"processing_ms": 120
}
}Test the API directly from this page. The demo key is pre-filled for convenience.
curl -X POST https://screenshot.endpnt.dev/api/v1/capture \
-H "x-api-key: ek_live_demo123" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"format": "png",
"width": 1280,
"height": 720,
"full_page": true,
"dark_mode": false
}'// Using fetch
const response = await fetch('https://screenshot.endpnt.dev/api/v1/capture', {
method: 'POST',
headers: {
'x-api-key': 'your_api_key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://example.com',
format: 'png',
width: 1280,
height: 720,
full_page: true
})
});
const result = await response.json();
if (result.success) {
// result.data.image contains base64 image data
const img = document.createElement('img');
img.src = `data:image/${result.data.format};base64,${result.data.image}`;
document.body.appendChild(img);
}// Using Node.js with axios
const axios = require('axios');
const fs = require('fs');
async function takeScreenshot(url) {
try {
const response = await axios.post(
'https://screenshot.endpnt.dev/api/v1/capture',
{
url: url,
format: 'png',
width: 1280,
height: 720,
full_page: true
},
{
headers: {
'x-api-key': 'your_api_key',
'Content-Type': 'application/json'
}
}
);
if (response.data.success) {
const imageBuffer = Buffer.from(response.data.data.image, 'base64');
fs.writeFileSync('screenshot.png', imageBuffer);
console.log('Screenshot saved!');
}
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
}
takeScreenshot('https://example.com');import requests
import base64
# Make the API request
response = requests.post(
'https://screenshot.endpnt.dev/api/v1/capture',
headers={
'x-api-key': 'your_api_key',
'Content-Type': 'application/json'
},
json={
'url': 'https://example.com',
'format': 'png',
'width': 1280,
'height': 720,
'full_page': True
}
)
result = response.json()
if result['success']:
# Decode and save the image
image_data = base64.b64decode(result['data']['image'])
with open('screenshot.png', 'wb') as f:
f.write(image_data)
print(f"Saved screenshot: {result['data']['width']}x{result['data']['height']}")| Code | Status | Description |
|---|---|---|
AUTH_REQUIRED | 401 | Missing x-api-key header |
INVALID_API_KEY | 401 | API key does not exist or is invalid |
RATE_LIMIT_EXCEEDED | 429 | Too many requests for your tier |
INVALID_URL | 400 | URL is malformed or not http/https |
INVALID_PARAMS | 400 | Parameter validation failed |
CAPTURE_FAILED | 500 | Browser could not capture the page |
TIMEOUT | 504 | Page took too long to load |
INTERNAL_ERROR | 500 | Internal server error |
Rate limits depend on your subscription tier:
Rate Limit Headers
Check the remaining_credits field in the response to track your usage. When limits are exceeded, you'll receive a 429 status code.
Can't find what you're looking for? We're here to help.