Skip to content

Configurable Caching
PRO

Hits are free. Set ttl with a humanized duration on any request — cache hits return instantly and cost nothing, and staleTtl keeps responses fast while refreshing.

Overview

A cache hit costs nothing.

Add ttl to any request to set its freshness window with a humanized duration — '1d', '12h', '30m'. Repeat calls inside the window are served from cache: free, instant, no browser. Add staleTtl to serve the cached value while a fresh one is fetched in the background.
  • Cache hits are free and return instantly — no browser boots
  • Humanized durations: '1d', '12h', '30m' — no raw seconds
  • staleTtl serves stale-while-revalidate for zero-latency refreshes
  • x-cache-status header tells you HIT or MISS on every response
  • Works on every product — screenshot, markdown, extract, run
Parameters

How caching is tuned.

Examples
A humanized '1d' window — repeat calls are free and fast.
Cache for a day
import createClient from 'microlink.io'

const microlink = createClient({
  apiKey: process.env.MICROLINK_API_KEY
})

const { url } = await microlink.screenshot(
  'https://example.com',
  { ttl: '1d' }
)