Skip to content

Pagination

The three list routes share page and limit. There is no cursor and no offset.

01Query

ParameterTypeDefaultNotes
pageinteger11-indexed. Minimum 1.
limitinteger20Minimum 1, maximum 100.

Used on /articles, /social/content, and /projects.

02Envelope

200Response
{
  "success": true,
  "data": [],
  "pagination": {
    "total": 42,
    "page": 2,
    "limit": 20,
    "total_pages": 3,
    "has_more": true
  },
  "meta": {
    "timestamp": "2026-02-01T00:00:00Z"
  }
}

03Walk every page

async function allArticles(apiKey) {
  const out = [];
  let page = 1;
  let hasMore = true;
  while (hasMore) {
    const res = await fetch(`https://www.brainpercent.app/api/v1/articles?page=${page}&limit=100`, {
      headers: { Authorization: `Bearer ${apiKey}` },
    });
    const { data, pagination } = await res.json();
    out.push(...data);
    hasMore = pagination.has_more;
    page += 1;
  }
  return out;
}