The Streamforge External API uses cursor-based pagination for all list endpoints. This approach provides stable, efficient pagination that avoids duplicates when data changes between requests.
Unlike offset-based pagination (e.g., page=1, page=2), cursor pagination uses opaque tokens that point to a specific position in the dataset. This means:
- Stable results: New items added to the beginning won’t cause duplicates
- Efficient: No need to skip through large offsets
- Consistent: Results remain consistent even as data updates
Using Cursors
All list endpoints return a next_cursor in the response metadata:
Choosing a Limit
The limit parameter controls how many items are returned per page:
- Minimum: 1 item
- Maximum: 50 items (for most endpoints)
- Default: 10 items
- Quota cost: Each item returned costs 1 quota unit
Limit Selection Guidelines
- Small datasets: Use
limit=50 to minimize requests
- Large datasets: Use
limit=10-25 for better progress tracking
- Real-time updates: Use smaller limits to detect new items faster
Cursor Stability
Cursors are stable tokens that remain valid even as new data arrives. However:
- Cursors don’t expire, but they may become less efficient over time
- If you pause pagination for days/weeks, consider restarting from the beginning
- Cursors encode the sort position, so changing sort order requires a new cursor
The following endpoints support cursor-based pagination:
GET /platforms/{platform}/content - List all content
GET /platforms/{platform}/profiles/{profile_id}/content - List content by creator
GET /platforms/{platform}/games/{game_id}/content - List content for a game
Best Practices
Always check if next_cursor is null before making another request. A null cursor means you’ve reached the end of the results.
- Respect rate limits: Don’t paginate too aggressively; monitor your quota usage
- Handle errors: Implement retry logic for failed pagination requests
- Store cursors: If resuming pagination, store the last cursor to avoid re-fetching data
- Batch processing: For large datasets, process items in batches rather than loading everything into memory
Example: Paginating Content
Common Pitfalls
Don’t use offset-based pagination patterns. The API doesn’t support page or offset parameters.
- Assuming page numbers: There are no page numbers; only cursors
- Reusing old cursors: While stable, very old cursors may not reflect current data
- Ignoring null cursors: Always check for
null to avoid infinite loops
- Not handling empty results: An empty
payload array with a null cursor means no results