Skip to main content
Caching in uAPI is intentionally simple. You either send the x-cache-ttl header or you do not.
x-cache-ttl
integer
Time-to-live in seconds for a successful GET response. Valid range is 0 to 3600. 0 disables caching for this request. A positive value enables caching for that many seconds.

Behavior

If you send x-cache-ttl with a value between 1 and 3600, uAPI may serve subsequent identical successful GET requests from your cache for that duration. If you send x-cache-ttl: 0 or omit the header, the response is not cached for reuse.
Caching is isolated per API key. Other users cannot see, populate, or evict your cache.

Scope

Caching applies only to successful GET requests such as /v1/extract. Errors and non-GET endpoints are never cached.

SDK usage

Prefer the official SDKs; they expose x-cache-ttl as a simple option.
import os
from uapi import uAPI

client = uAPI(api_key=os.environ.get("UAPI_API_KEY"))

# Cache for 600 seconds
resp_cached = client.extract(
    url="https://example.com",
    x_cache_ttl=600,
)

# Disable caching for this request
resp_nocache = client.extract(
    url="https://example.com",
    x_cache_ttl=0,
)

Practical guidance

Use x-cache-ttl for URLs you call frequently and can safely reuse for up to an hour. Use 0 for highly dynamic or sensitive pages. For consistent behavior across environments, always set an explicit x-cache-ttl rather than relying on implicit defaults.
You do not need to manage or interpret internal cache headers or implementation details. The only contract surface for caching is the x-cache-ttl header on your request.