Skip to main content

Overview

Endpoints that return lists of cards use page-based pagination. Results are returned in fixed-size pages and you increment the page number until you receive an empty array, which signals the end of the result set.

How it works

Add a page query parameter to your request, starting at 0. Each response returns one page of results. When the response is an empty array, you have reached the end.
curl "https://api.getaptly.com/api/aptlet/YOUR_BOARD_ID/cards?page=0" \
  -H "x-token: YOUR_API_KEY"

Fetching all cards

The following example in JavaScript loops through all pages and collects every card:
async function getAllCards(boardId, apiKey) {
  const cards = [];
  let page = 0;

  while (true) {
    const response = await fetch(
      `https://api.getaptly.com/api/aptlet/${boardId}/cards?page=${page}`,
      { headers: { "x-token": apiKey } }
    );

    const data = await response.json();

    if (!data || data.length === 0) break;

    cards.push(...data);
    page++;
  }

  return cards;
}
And the equivalent in Python:
import requests

def get_all_cards(board_id, api_key):
    cards = []
    page = 0

    while True:
        response = requests.get(
            f"https://api.getaptly.com/api/aptlet/{board_id}/cards",
            headers={"x-token": api_key},
            params={"page": page}
        )

        data = response.json()

        if not data:
            break

        cards.extend(data)
        page += 1

    return cards

Tips

  • Page numbering starts at 0, not 1
  • An empty array ([]) means there are no more results
  • Avoid requesting pages in parallel as results may overlap or skip records if cards are being modified during retrieval