Caching Website Screenshots

Improve Performance and Reduce Usage

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.

How do I enable screenshot caching?

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.

What is an example of a website screenshot request cached for a day?

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

What are the common screenshot caching durations?

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

What is the default screenshot cache duration?

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.

Can I use my own content delivery network (CDN) provider such as Cloudflare, Fastly, Azure or Amazon to cache my screenshots?

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.

How does screenshot caching work?

When a screenshot is taken of a website, Add Screenshots will:

  1. Get the unique screenshot URL and options (e.g., quality, format, viewport)
  2. Look for an existing screenshot image in the cache if caching is enabled (via the ttl parameter)
  3. Return the cached screenshot if it is found in the cached and hasn't expired yet
  4. Capture a fresh copy of the screenshot
  5. Add the screenshot to cache, stored against your account
  6. Return the screenshot

Where are my cached screenshots stored?

Add Screenshots use Cloudflare to cache screenshot images.

What are the limitations of screenshot caching?

Screenshot caching limitations are:

  1. GET requests only (POST requests will not be cached)
  2. Active accounts only

Caching Benefits

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.