Skip to content
Partner API Docs

Pagination

MyStocks list endpoints use cursor-based pagination — pass ?limit= and ?cursor=; every response carries hasMore and nextCursor so you never calculate offsets. Per-endpoint defaults and maximums included.

List endpoints use cursor-based pagination. Pass ?limit= to control page size and ?cursor= to advance to the next page. Every paginated response includes hasMore and nextCursor so you never need to calculate offsets.

Request parameters

FieldTypeRequiredDescription
limitintegerNoItems per page. Default and max vary by endpoint (see below). Clamped to the endpoint maximum if exceeded.
cursorstringNoOpaque cursor returned as nextCursor in the previous response. Omit on the first request. Treat cursors as opaque strings — do not construct or parse them.

Response fields

FieldTypeRequiredDescription
countintegerNoNumber of items in this page (≤ limit).
hasMorebooleanNotrue if at least one more page exists. false means this is the last page.
nextCursorstring | nullNoPass as ?cursor= on the next request. null when hasMore is false.

Limit defaults & maximums by endpoint

EndpointDefaultMax
GET /users100500
GET /orders50200
GET /users/{userId}/orders50200
GET /users/{userId}/transactions50200
GET /audit50200
GET /webhooks/{id}/deliveries20100

Fetching all pages — JavaScript

async function fetchAllOrders(apiKey) {
  const orders = [];
  let cursor = null;
 
  do {
    const url = new URL('https://mystocks.africa/api/v1/partner/orders');
    url.searchParams.set('limit', '200');
    if (cursor) url.searchParams.set('cursor', cursor);
 
    const res = await fetch(url, { headers: { 'x-api-key': apiKey } });
    const page = await res.json();
 
    orders.push(...page.orders);
    cursor = page.nextCursor; // null on the last page
  } while (cursor);
 
  return orders;
}

Cursor stability. Cursors are Firestore document IDs and remain valid indefinitely. New items inserted after your first request appear in subsequent pages if they sort after the cursor position — consistent forward-only iteration is guaranteed. Do not cache cursors across API-key rotations.

On this page