Screenshot API
Capture visual snapshots of any web page as it appears in a real browser. Full-page or viewport-sized screenshots in PNG, JPEG, or WebP, delivered as base64 or raw binary.
Capture at Any Size
Set custom viewport dimensions or use defaults. Full-page mode scrolls and captures everything.
Output Modes
"binary": false (default) Base64 Encoded
Screenshot returned as a base64 string in JSON. Convenient for embedding in HTML, storing in databases, or passing to downstream APIs.
"binary": true Raw Binary
Returns raw image bytes directly. Ideal for saving to disk, uploading to cloud storage, or serving to users. Smaller payload than base64.
Screenshot Formats
Key Capabilities
Full-Page Capture
Capture the entire scrollable page, not just the visible viewport. Enabled by default with full_page: true.
CDP Parameters
Fine-tune with Chrome DevTools Protocol params. Set custom clip regions, output format, and compression quality.
Transparent Background
Use omit_background to capture pages with transparency — useful for compositing or clean visuals.
Image Blocking
Speed up captures by blocking images with block_images. Useful when you need the layout but not the visuals.
Anti-Bot Handling
Screenshot protected pages. Spider's fingerprinting and session management make it look like a real user.
Geo-Routing
Capture how pages look from different countries via country_code. See geo-specific pricing or localized content.
Code Examples
from spider import Spider
import base64
client = Spider()
result = client.screenshot(
"https://example.com",
params={
"full_page": True,
}
)
# Decode and save the screenshot
img_data = base64.b64decode(result[0]["content"])
with open("screenshot.png", "wb") as f:
f.write(img_data) curl -X POST https://api.spider.cloud/screenshot \
-H "Authorization: Bearer $SPIDER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"binary": true,
"full_page": true,
"cdp_params": {
"format": "jpeg",
"quality": 80
}
}' --output screenshot.jpg import Spider from "@spider-cloud/spider-client";
const client = new Spider();
const result = await client.screenshot("https://example.com", {
full_page: true,
});
// result[0].content contains the base64 screenshot
console.log(`Screenshot size: ${result[0].content.length} chars`); Popular Use Cases
Visual Regression Testing
Capture screenshots on every deploy and compare against baselines. Detect unintended visual changes before users do.
Link Previews & Thumbnails
Generate preview images for URLs shared in your application. Build rich link cards like those in social media and messaging apps.
Competitive Monitoring
Periodically screenshot competitor sites to track visual changes, pricing updates, and new product launches.
Compliance & Archiving
Create visual records for legal, regulatory, or archival purposes. Capture exactly what a user would see at a given point in time.