Caching

Cache results to avoid re-capturing the same URL and reduce quota usage.

Pass cache_ttl to cache the result for a given number of seconds. Subsequent identical requests within that window return the cached result without consuming quota.

The X-Cache response header tells you whether a response was a cache HIT or MISS.

Parameters

NameTypeRequiredDescription
cache_ttlintegeroptionalCache lifetime in seconds (0–86400). 0 disables caching. Default: 0.

Code Examples

# Cache for 1 hour; second request within 1h returns instantly
curl "https://screenshotcore.com/api/v1/screenshot?access_key=KEY&url=https://example.com&cache_ttl=3600" -o out.png

# Check the X-Cache header to see if it was a HIT
curl -v "https://screenshotcore.com/api/v1/screenshot?access_key=KEY&url=https://example.com&cache_ttl=3600" -o out.png 2>&1 | grep X-Cache

Response

(Raw PNG bytes, headers include:
  X-Cache: MISS
  X-Response-Time: 1840)