Skip to main content
List endpoints return results one page at a time using cursor-based pagination. Each response includes a data array for the current page, a has_next boolean, and a cursor string to fetch the next page. Cursor pagination is stable: inserting or deleting records between requests will not cause items to be skipped or duplicated.

Query parameters

All paginated endpoints accept these parameters:
ParameterTypeDefaultMaximumDescription
limitinteger10100Items per page
cursorstringCursor from the previous response. Omit for first page.

Response structure

{
  "data": [...],
  "has_next": true,
  "cursor": "eyJvcGVuZWRfYXQiOiIyMDI2LTAzLTEyVDE2OjQ1OjAwWiIsImlkIjoiYWNjb3VudF9XcDVtUngzbkt2OGJUaDJkIn0"
}
cursor is null when this is the last page. Pass it as the cursor query parameter on the next request to fetch the following page.

Fetching all pages

To retrieve every item, keep requesting until has_next is false:
async function fetchAllTransactions(accountId: string) {
  const results = [];
  let cursor: string | null = null;

  do {
    const params = new URLSearchParams({ account_id: accountId, limit: "100" });
    if (cursor) {
      params.set("cursor", cursor);
    }

    const response = await fetch(
      `https://api.getlemma.com/v0/transactions?${params}`,
      { headers: { Authorization: `Bearer ${API_KEY}` } },
    );
    const page = await response.json();

    results.push(...page.data);
    cursor = page.has_next ? page.cursor : null;
  } while (cursor);

  return results;
}