Caching

RenderScreenshot caches screenshots on a global CDN to improve performance and reduce costs.

How Caching Works

  1. Each unique URL + options combination generates a cache key
  2. First request renders the screenshot and stores it on CDN
  3. Subsequent requests serve from cache
  4. You only pay for renders, not cache hits

Cache Key

The cache key is based on:

  • Target URL
  • All screenshot options (viewport, format, etc.)
  • API key mode (live vs test)

Changing any option creates a new cache entry.

Default TTL

Screenshots are cached for 24 hours by default.

Controlling Cache

Force Refresh

Bypass cache and force a new render:

{
  "url": "https://example.com",
  "cache": {
    "refresh": true
  }
}

Custom TTL

Set a custom cache duration (in seconds):

{
  "url": "https://example.com",
  "cache": {
    "ttl": 3600
  }
}

Maximum TTL is 30 days (2,592,000 seconds).

Disable Caching

Disable caching entirely for this request:

{
  "url": "https://example.com",
  "cache": {
    "enabled": false
  }
}

Note: This still counts as a render for billing purposes.

Cache Headers

Check cache status via response headers:

X-Cache-Status: HIT    # Served from cache
X-Cache-Status: MISS   # Fresh render

CDN URL

Every response includes an X-Cache-URL header with a public CDN link:

X-Cache-URL: https://cdn.renderscreenshot.com/screenshots/abc123.png

This URL:

  • Requires no authentication
  • Is safe for public HTML
  • Remains valid until the cache expires

Was this page helpful?