ReddGrowReddGrow Docs
API v1

Pagination

How to paginate list endpoints in the ReddGrow API v1

Overview

All list endpoints use offset/limit pagination. There is no cursor — you can jump to any page directly.

Request Parameters

ParameterTypeDefaultMaxDescription
limitinteger20100Number of items to return
offsetinteger0Number of items to skip

Response Shape

Every list endpoint returns the same envelope:

{
  "data": [ ... ],
  "meta": {
    "total": 347,
    "limit": 20,
    "offset": 40,
    "has_more": true
  }
}
  • total — total number of matching records (ignoring pagination)
  • limit — the limit that was applied
  • offset — the offset that was applied
  • has_moretrue when offset + limit < total

Example

Fetch the third page of pending drafts (items 41–60):

curl -H "x-api-key: rg_..." \
  "https://api.reddgrow.ai/v1/drafts?status=pending&limit=20&offset=40"

Response:

{
  "data": [
    { "id": 101, "status": "pending", "body": "...", ... },
    { "id": 102, "status": "pending", "body": "...", ... }
  ],
  "meta": {
    "total": 347,
    "limit": 20,
    "offset": 40,
    "has_more": true
  }
}

Iterating All Pages

Keep fetching until has_more is false:

let offset = 0;
const limit = 100;
let allDrafts = [];

while (true) {
  const res = await fetch(
    `https://api.reddgrow.ai/v1/drafts?limit=${limit}&offset=${offset}`,
    { headers: { "x-api-key": "rg_..." } }
  );
  const { data, meta } = await res.json();
  allDrafts = allDrafts.concat(data);
  if (!meta.has_more) break;
  offset += limit;
}