Sapa Moto

Pagination

Cursor pagination for lists — stable under inserts, no page numbers.

GET /v1/orders returns orders newest first, one page at a time:

200 OK
{
  "items": [ { "id": "0192f1b2-…", "external_id": "SHOP-100245", "status": "to_dropoff" } ],
  "next_cursor": "YzF8MDE5MmYxYjItNmQ0ZS03YTEwLWIzYzItOGUxZjBkOWE0YzU3"
}
ParameterMeaning
limitpage size, 1–200, default 50
cursornext_cursor of the previous page; omit for the first page
status, from, to, point_idfilters — keep them the same on every page

next_cursor is null on the last page. The cursor is opaque: do not parse or build it — a changed cursor gives 400 invalid_cursor. New orders created while you page do not shift the pages (keyset pagination).

async function* allOrders(params = {}) {
  let cursor;
  do {
    const q = new URLSearchParams({ ...params, limit: "200", ...(cursor ? { cursor } : {}) });
    const page = await fetch(`https://partner.sapamoto.kz/v1/orders?${q}`, {
      headers: { Authorization: `Bearer ${process.env.SAPA_KEY}` },
    }).then((r) => r.json());
    yield* page.items;
    cursor = page.next_cursor;
  } while (cursor);
}

for await (const order of allOrders({ from: "2026-10-24T00:00:00+05:00" })) console.log(order.external_id);

These docs are built from the platform's OpenAPI specification. Download OpenAPI