Skip to content

Core concepts

Caching

Serve repeated requests instantly with edge caching for up to 30 days.

Add cache=true to /v1/capture, /v1/content or /v1/analyze to store the response. Identical requests within the TTL are served from cache without rendering again.

Parameter Type Default Description
cache boolean false Enable caching for this request.
cache_ttl number (seconds) 86400 (1 day) How long the response stays cached. Maximum 2,592,000 (30 days).
curl -G "http://localhost:4000/v1/capture" \
  --data-urlencode "url=https://example.com" \
  -d cache=true -d cache_ttl=604800 \
  -H "x-api-key: $SNAPLENS_API_KEY" -D - -o shot.png

The x-cache header

Every cacheable response includes:

Header Meaning
x-cache: MISS Rendered now (and stored, if cache=true).
x-cache: HIT Served from cache.

Cache keys

The cache key includes the endpoint and all parameters that affect the output (URL, format, viewport, device, selectors, blocking options…). Changing any of them produces a separate cache entry. Your API key is not part of the key, but caches are isolated per workspace.

Billing

A cache hit counts as a successful request and uses one credit, but it returns almost instantly and isn't subject to rendering time.

Choosing a TTL

Content Suggested TTL
Static marketing pages 1–7 days
Documentation, articles 7–30 days
News, dashboards 15–60 minutes
Prices, stock, live data Don't cache

Forcing a refresh

Omit cache=true to always render a fresh result. The new response doesn't replace the cached entry; send it with cache=true again later to re-populate once the TTL expires.