When taking screenshots of a website, it's common to take multiple shots of the same page, especially if you're monitoring it for changes.
The follow guide provides an overview on how to use a cached website screenshot to significantly improve performance and reduce your screenshot usage count when taking repeated screenshots of the same web page.
Use the ttl
(which stands for time to live) URL parameter to specify how long the screenshot should be cached for in seconds.
For example, adding &ttl=30
will cache the screenshot for 30 seconds.
The request below will take a screenshot of google.com and cache it for a day (86400 seconds).
// Line breaks added for readability
https://api.addscreenshots.com/screenshots
?apikey=YOUR_API_KEY
&ttl=86400
&url=google.com
Here is a list of common ttl (time to live) values:
Cache Duration | URL Parameter |
---|---|
10 minutes | &ttl=600 |
1 hour | &ttl=3600 |
1 day | &ttl=86400 |
1 week | &ttl=604800 |
1 month | &ttl=2592000 |
By default, website screenshots are not cached at all (no cache).
This means that you will always receive the latest, up to date screenshot with every request, which works well for dynamic websites that updates frequently such as a Power BI report dashboard.
By not caching screenshots (by default) means that your potential highly sensitive website screenshots are not stored anywhere.
Absolutely. A popular choice is to capture screenshots and store the images directly on your own cloud storage account such as Azure Blob Storage or an AWS S3 Bucket. This allows you to point your CDN to your storage account for full control.
When a screenshot is taken of a website, Add Screenshots will:
Add Screenshots use Cloudflare to cache screenshot images.
Screenshot caching limitations are:
Caching website screenshots is a simple way to improve website performance and reduce screenshot usage. By implementing a caching policy, you can ensure that you're not serving outdated content and reduce the number of API calls needed to generate screenshots.