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
| Property | Value |
|---|---|
| Type | boolean |
| Default | true |
| Required | No |
Behavior
When feed_refresh = true (default)
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
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_refresh | Operation | Compute Units |
|---|---|---|
true (default) | Feed Update | 150 units |
false | Feed Fetch | 25 units |
Setting feed_refresh = false reduces costs by ~83% per request (125 units saved).
For current pricing details, see Compute Units Pricing.
Use Cases
| Scenario | Recommended Value | Reason |
|---|---|---|
| Normal browsing | true (default) | Keeps recommendations fresh |
| Polling/prefetch requests | false | Reduces backend load and costs |
| High-frequency API calls | false | Prevents unnecessary processing and expense |
| Testing | false | Provides predictable responses |
| Cost optimization | false | 83% reduction in compute units |
Example Request
{
"feed_id": "feed_390",
"user_id": "1",
"top_k": 25,
"feed_refresh": false
}When to Use false
falseSet feed_refresh to false when you:
- Prefetch content - Loading feed data in the background before user views it
- Poll for updates - Checking for new content at regular intervals
- Run automated tests - Need consistent, repeatable responses
- Optimize costs - Save 125 compute units per request (83% reduction)
Notes
- Setting
feed_refreshtofalsedoes 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
Updated 7 days ago
