Capturing Screenshots
This guide provides comprehensive examples of using the Screenshotly API to capture screenshots with various options and features.Quick Start
Basic Screenshot
The simplest way to capture a screenshot:Save to File
Save the screenshot directly to a file:Device & Viewport Options
Predefined Devices
Use standard device presets for consistent screenshots:Custom Viewport
For specific dimensions:Output Formats
PNG (Default)
Best for screenshots with transparency:JPEG with Quality
Smaller file size with adjustable quality:PDF Format
For document-style output:Capture Options
Full Page Screenshots
Capture the entire scrollable page:Element Screenshots
Capture specific elements:Delayed Capture
Wait for dynamic content:AI Element Removal
Basic Usage
Remove common unwanted elements:Advanced Configuration
Fine-tune element removal:Element Type Guide
Choose which elements to remove:cookie-banner: Cookie notices, GDPR bannersnewsletter: Signup forms, subscription promptschat-widget: Support chats, messenger widgetssocial-overlay: Share buttons, social media widgetsad: Advertisements, promotional content
Confidence Levels
Adjust the confidence threshold:- 0.9: High precision, fewer false positives
- 0.8: Balanced (recommended)
- 0.7: More aggressive, might include more elements
- 0.6: Most aggressive, higher chance of false positives
Device Mockups
Browser Mockup
Add a modern browser frame:Mobile Device Mockup
Show in an iPhone frame:Error Handling
Implement robust error handling:Best Practices
-
Rate Limiting
- Monitor your usage with response headers
- Implement backoff when approaching limits
- Consider caching frequently accessed screenshots
-
Performance
- Use appropriate image formats
- Enable AI removal only when needed
- Set reasonable delays for dynamic content
-
Quality
- Use PNG for highest quality
- Adjust JPEG quality based on needs
- Test different device viewports
-
Reliability
- Implement proper error handling
- Check rate limit headers
- Cache screenshots when possible
-
AI Removal
- Start with high confidence (0.8-0.9)
- Enable only needed element types
- Use delay with dynamic elements
Next Steps
- Explore mockup templates
- Learn about API tokens
- View the API reference