Skip to main content

With Exa, we can already search the web using LLMs. By default, we serve cached content to bias for the fastest response possible. If you need fresher content, use the maxAgeHours parameter to control how old cached content can be before we fetch a live version.

maxAgeHours

maxAgeHours sets the maximum acceptable age (in hours) for cached content. If the cached version is older than this threshold, Exa will livecrawl the page to get fresh content.
ValueBehaviorBest For
24Use cache if less than 24 hours old, otherwise livecrawlDaily-fresh content
1Use cache if less than 1 hour old, otherwise livecrawlNear real-time data
0Always livecrawl (ignore cache entirely)Real-time data where cached content is unusable
-1Never livecrawl (cache only)Maximum speed, historical/static content
(omit)Default behavior (livecrawl as fallback if no cache exists)Recommended — balanced speed and freshness

When LiveCrawl Isn’t Necessary

Cached data is sufficient for many queries, especially for historical topics like “What were the major causes of World War II?” or educational content such as “How does photosynthesis work?” These subjects rarely change, so reliable cached results can provide accurate information quickly.

Examples

Company News

Set maxAgeHours to a low value to ensure you get fresh content. Pair with livecrawlTimeout to prevent long-running calls from hanging:
curl -X POST 'https://api.exa.ai/contents' \
  -H 'x-api-key: YOUR-EXA-API-KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "ids": ["https://www.apple.com"],
    "maxAgeHours": 1,
    "livecrawlTimeout": 12000
  }'

Production Applications

For production apps, set maxAgeHours to match how frequently your target content changes. Pair with livecrawlTimeout for reliability:
curl -X POST 'https://api.exa.ai/contents' \
  -H 'x-api-key: YOUR-EXA-API-KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "ids": ["https://www.apple.com"],
    "maxAgeHours": 24,
    "livecrawlTimeout": 12000
  }'
This will serve cached content if it’s less than 24 hours old, and livecrawl otherwise. If the livecrawl fails or times out, it falls back to cached content, making it ideal for production applications.

Deprecated: livecrawl options

The livecrawl string parameter ("always", "preferred", "fallback", "never") is deprecated in favor of maxAgeHours. Existing code using livecrawl will continue to work, but we recommend migrating to maxAgeHours for more precise control over content freshness.
Old livecrawl valueEquivalent maxAgeHours
"always"0
"never"-1
"fallback"(omit — default)
"preferred" has no direct equivalent since it always livecrawls regardless of cache age. Use a low maxAgeHours value (e.g. 1) for similar behavior.