Skip to content
API & IntegrationsDocumentation

API: Pagination

Cursor-based pagination for list endpoints.

How Pagination Works

List endpoints that can return large datasets use cursor-based pagination. Instead of page numbers, each response includes a cursor pointing to the last returned item.

Pass that cursor as the after query parameter to fetch the next page.

Query Parameters

  • limit — Number of items per page (default varies per endpoint, max 500).
  • after — Cursor string returned in the previous response as pagination.nextCursor.

Response Envelope

Every paginated endpoint wraps its results in a data array alongside a pagination object:

{
  "data": [ ... ],
  "pagination": {
    "limit": 100,
    "nextCursor": "cm9wa3BqMzQ1Ng",
    "hasMore": true
  }
}

Iterating All Pages

Keep fetching with after=nextCursor until hasMore is false:

async function* fetchAllIssues(projectId, apiKey) {
  let cursor = undefined;
  do {
    const params = cursor ? '?after=' + cursor : '';
    const res = await fetch(
      'https://api.ablelytics.com/v1/projects/' + projectId + '/issues' + params,
      { headers: { 'x-api-key': apiKey } }
    );
    const { data, pagination } = await res.json();
    yield* data;
    cursor = pagination.hasMore ? pagination.nextCursor : undefined;
  } while (cursor);
}

Paginated Endpoints

  • GET /v1/projects/:id/pages — default limit 50, max 500
  • GET /v1/projects/:id/issues — default limit 100, max 500
  • GET /v1/projects/:id/reports — default limit 50
  • GET /v1/projects/:id/page-sets/:setId/pages — default limit 50, max 500