Skip to main content

Pagination

List endpoints accept page (1-based) and limit, and return a meta block.

curl "https://api.minetech.rw/v1/operations/lots?page=2&limit=50" \
-H "Authorization: Bearer $MINETECH_API_KEY"
{
"data": [],
"meta": { "page": 2, "limit": 50, "total": 1284, "totalPages": 26 }
}

limit is capped server-side. Requesting more returns the cap rather than an error, so always read meta.limit rather than assuming you got what you asked for.

With the SDK

A single page — list() is directly awaitable:

const { items, meta } = await client.operations.lots.list({ limit: 50 });

Every record, fetched lazily as you consume it:

for await (const lot of client.operations.lots.list({ siteId }).autoPaging()) {
await process(lot);
}

This holds one page in memory at a time, so it is safe over large datasets. Prefer it to collecting everything.

Bounded collection when you do want an array:

const recent = await client.operations.lots
.list({ limit: 100 })
.toArray({ maxItems: 1000 });

autoPaging stops on a short page or when meta.totalPages is reached, and has an internal page ceiling so a server that never advances cannot loop forever.

Stable ordering

Pass an explicit sortBy when paging through data that is being written concurrently. Without a deterministic sort, a record inserted mid-scan can shift rows across page boundaries and you may see one twice or miss it entirely — that is inherent to offset pagination, not specific to MineTech.