RoomScope

最後更新

分頁

可能無限增長的清單會以不透明的游標分頁。用 limit 指定每頁筆數,再把每一頁的 nextCursor 傳回去,即可取得下一頁。

游標

分頁的回應會帶有 nextCursor。請將它作為 cursor 查詢參數傳回,以取得下一頁;當它為 null 時,表示已經沒有更舊的資料。頁面依由新到舊排序。請將游標視為不透明的值:其格式可能會變動。

GET /v1/live/sessions?limit=100
{  "data": {    "items": [ … ],    "nextCursor": "2026-10-31T07:51:44.935Z",    "historyWindowDays": 365,    "historyTruncated": false  }}

每個清單都有自己的 limit 範圍與預設值;API 參考會在參數旁標示。每一頁都以一次呼叫計費。

歷史紀錄範圍

可讀取的歷史紀錄受方案限制。historyWindowDays 表示工作區可往回讀取多久的資料,而 historyTruncated: true 表示有更舊的資料存在,但位於該範圍之外。

短清單不分頁
排行榜榜單、地區、提醒規則與匯出檔都會一次完整回傳;在適用時可以帶入 limit,但不使用游標。

讀取所有頁面

let cursor = null;const sessions = [];do {  const params = new URLSearchParams({ limit: "100", ...(cursor ? { cursor } : {}) });  const res = await fetch(`https://api.toktokdata.live/v1/live/sessions?${params}`, {    headers: { Authorization: `Bearer ${process.env.ROOMSCOPE_API_KEY}` },  });  const { data } = await res.json();  sessions.push(...data.items);  cursor = data.nextCursor;} while (cursor);
這個頁面對你有幫助嗎?