Caching

Enable caching to serve repeated screenshots instantly from our CDN, reducing latency and costs.

Enable Caching

Add cache=true to your request:

https://api.lambdashot.com/take?url=https://example.com&cache=true&access_key=YOUR_KEY

Parameters

ParameterDescriptionDefault
cacheEnable cachingfalse
cache_ttlCache duration in seconds (14,400 to 2,592,000)14400 (4 hours)
cache_keyCustom cache key for variants

How It Works

  1. First request renders the screenshot and stores it in our CDN
  2. Subsequent requests with the same parameters return the cached version
  3. Cache expires after the TTL period
  4. Only API requests can refresh the cache

Cache Key

Screenshots are cached based on all request parameters. Changing any parameter results in a new cache entry.

Use the cache_key parameter to create multiple cached versions of the same screenshot:

// Version A
?url=https://example.com&cache=true&cache_key=version-a

// Version B (same URL, different cache)
?url=https://example.com&cache=true&cache_key=version-b

Cache URL

When using response_type=json, the response includes a cache_url that links directly to the cached image:

{
  "screenshot_url": "...",
  "cache_url": "https://cdn.lambdashot.com/cache/abc123.png"
}
    

You can share this URL without exposing your API key. The URL remains valid for the cache TTL duration.

Benefits

  • Faster responses — Cached screenshots are served from Cloudflare's global CDN
  • Lower costs — Cached requests don't count against your usage
  • Share safely — Cache URLs don't expose your API key
  • Reduced load — Target websites aren't hit on cached requests

Example: Cache for 24 Hours

https://api.lambdashot.com/take?url=https://example.com&cache=true&cache_ttl=86400&access_key=YOUR_KEY

Important Notes

  • Minimum TTL: 4 hours (14,400 seconds)
  • Maximum TTL: 30 days (2,592,000 seconds)
  • Cache is not intended for CDN-like high-traffic scenarios
  • Expired cache URLs return 404
  • To force a cache refresh, change the cache_key or wait for expiration