Developers / Pagination

Pagination

Lists come one page at a time. Ask with page and size, and keep going until you have them all.

Updated 4 November 2026API v1.0.1

Ask for a page#

ParameterDefaultWhat it does
page1Which page, starting at 1.
size50How many items on a page, 1 to 200.
Shell
curl "https://coresyncapi.avitechcloud.com/api/v1/payments?page=2&size=100" \
  -H "X-API-Key: $CORESYNC_API_KEY"

Read the page#

FieldWhat it is
itemsThe records on this page.
totalHow many records match, across all pages.
pageThis page's number.
sizeThe page size that was used.
Response · 200
{
  "items": [
    {
      "id": "3f2a6c1e-8b7d-4c1a-9e2f-1a2b3c4d5e6f",
      "account_number": "AL-01042",
      "subscriber_code": "AL1042",
      "username": "wanjiku.k",
      "name": "Wanjiku Kamau",
      "phone": "+254712345678",
      "email": "wanjiku@example.com",
      "status": "ACTIVE",
      "service_type": "PPPOE",
      "online": true,
      "plan_name": "Home 10 Mbps",
      "expires_at": "2026-11-25T09:00:00Z",
      "credit_balance": {
        "amount": "300.00",
        "currency": "KES"
      }
    }
  ],
  "total": 137,
  "page": 1,
  "size": 50
}

Get every page#

Ask for page + 1 until page × size reaches total. These use the helper from the quickstart.

// Every item of a list, one page at a time.
async function* everything(path, query = {}) {
  for (let page = 1; ; page++) {
    const res = await api(path, { query: { ...query, page, size: 200 } });
    yield* res.items;
    if (res.items.length === 0 || page * res.size >= res.total) return;
  }
}

for await (const p of everything("/payments", { from: "2026-10-01T00:00:00Z" })) {
  console.log(p.received_at, p.reference, p.amount.amount);
}

Good to know#

  • Lists are newest first. Plans are sorted by name.
  • Pages are counted when you ask. If new records arrive while you page through a newest-first list, older ones move down a page, and you can see one twice. Skip ids you have already seen, or narrow the list with from and to where the operation has them.
  • A page past the end comes back with empty items and the real total.
  • A size over 200 or a page under 1 answers 400 validation_failed.
  • GET /webhooks returns a plain list, not a page: an ISP has at most 10 endpoints.

These operations return pages:

NextIdempotency →

Stuck, or missing something? Tell us what you're building.

hello@coresyncisp.com