Optimizing API costs

Use feed updates and feed fetches diligently to mitigate your API costs.

feed_refresh Parameter

The feed_refresh parameter is a boolean flag in the For You API that controls whether API calls trigger asynchronous background cache updates.

Quick Reference

PropertyValue
Typeboolean
Defaulttrue
RequiredNo

Behavior

When feed_refresh = true (default)

  • Returns current cached feed recommendations
  • Triggers background cache update via Kinesis or Lambda async invocation
  • Update refreshes personalized recommendations with fresh engagement data, affinity scores, and new content

When feed_refresh = false

  • Returns current cached feed recommendations
  • Skips background cache update entirely
  • No additional backend processing occurs

Cost Impact

The feed_refresh parameter determines which operation is billed:

feed_refreshOperationCompute Units
true (default)Feed Update150 units
falseFeed Fetch25 units

Setting feed_refresh = false reduces costs by ~83% per request (125 units saved).

For current pricing details, see Compute Units Pricing.

Use Cases

ScenarioRecommended ValueReason
Normal browsingtrue (default)Keeps recommendations fresh
Polling/prefetch requestsfalseReduces backend load and costs
High-frequency API callsfalsePrevents unnecessary processing and expense
TestingfalseProvides predictable responses
Cost optimizationfalse83% reduction in compute units

Example Request

{
  "feed_id": "feed_390",
  "user_id": "1",
  "top_k": 25,
  "feed_refresh": false
}

When to Use false

Set feed_refresh to false when you:

  1. Prefetch content - Loading feed data in the background before user views it
  2. Poll for updates - Checking for new content at regular intervals
  3. Run automated tests - Need consistent, repeatable responses
  4. Optimize costs - Save 125 compute units per request (83% reduction)

Notes

  • Setting feed_refresh to false does not affect the quality of the returned recommendations
  • The response data is identical regardless of this parameter's value
  • Only the background processing behavior changes