Core Concepts
Pagination
List endpoints return pages. Walk them with limit and offset.
List endpoints take limit (1 to 100, default 25) and offset (default 0), and return the page in data with a pagination object. When hasMore is true, ask again with offset raised by limit.
{
"data": [
"..."
],
"pagination": {
"limit": 25,
"offset": 0,
"hasMore": true
}
}Fetch Every Page
async function listAllPosts() {
const posts = [];
for (let offset = 0; ; offset += 100) {
const url = `https://app.tryredrover.com/api/public/v1/posts?limit=100&offset=${offset}`;
const response = await fetch(url, {
headers: {
Authorization: `Bearer ${process.env.REDROVER_API_KEY}`,
"X-Workspace-Id": process.env.REDROVER_WORKSPACE_ID,
},
});
const { data, pagination } = await response.json();
posts.push(...data);
if (!pagination.hasMore) return posts;
}
}Lists are ordered so new content does not shuffle earlier pages much, but content can change between requests. Use IDs, not positions, to match items.
