Skip to content

Pagination

Cursor, page, and limit in Admin and Storefront lists.

Admin lists and Storefront account lists use cursor pagination. The Storefront catalog (GET /v1/products) uses page numbers. Each operation in the reference shows which one it uses.

SchemeParametersWhere
Cursorcursor, limitAlmost every Admin list; on Storefront, reviews, customer orders, and store locations.
Pagepage, pageSizeStorefront GET /v1/products and Admin GET /v1/notifications/templates.
LimitlimitShort lists with no next page: related products, recommendations, and geographic areas.

Cursor

Request the first page without cursor. For the next one, send the previous response's nextCursor with the same filters and sort.

curl "https://api.ecomiq.pe/api/v1/catalog/brands?limit=50" \
  -H "Authorization: Bearer $ECOMIQ_TOKEN"
Response
{
  "data": [{ "id": "7204558912004324355", "name": "Andes" }],
  "hasNextPage": true,
  "nextCursor": "eyJpZCI6IjcyMDQ1NTg5MTIwMDQzMjUzMDEifQ",
  "totalCount": 132
}
ParameterValue
limit1 to 200. If you omit it, most lists return 20.
cursorThe previous page's nextCursor. Omit it on the first page.
sortBySort field; each operation lists the accepted values.
sortDirectionasc or desc.
searchFree text.
FieldMeaning
dataThe items on this page.
hasNextPagetrue when at least one more page remains.
nextCursorCursor for the next page; null on the last one.
totalCountTotal matches. May be null.

Some lists cap the page below 200, for example at 100, and return at most that many items even if you ask for more. A limit outside 1–200 returns 400. A cursor that can't be read returns 400 with Common.InvalidCursor.

walk-by-cursor.ts
async function* walkByCursor(firstUrl: URL, token: string) {
  let cursor: string | null = null;

  do {
    const url = new URL(firstUrl);
    if (cursor) url.searchParams.set("cursor", cursor);

    const response = await fetch(url, {
      headers: { Authorization: `Bearer ${token}` },
    });
    if (!response.ok) throw new Error(`HTTP ${response.status}`);

    const page = await response.json();
    yield* page.data;
    cursor = page.hasNextPage ? page.nextCursor : null;
  } while (cursor);
}

Page

page starts at 1. On Storefront GET /v1/products, pageSize ranges from 1 to 100 (24 by default) and page goes up to 100.

curl "https://storefront.ecomiq.pe/v1/products?page=2&pageSize=24" \
  -H "x-Store-Domain: my-store"

The response includes pageIndex, pageSize, totalCount, and totalPages, with the items in products. Keep increasing page while pageIndex is lower than totalPages.

Admin GET /v1/notifications/templates returns data, pageIndex, totalPages, hasPreviousPage, and hasNextPage; there pageSize ranges from 1 to 100.

Limit only

These operations return a short list and have no next page. limit sets how many items you want; to walk the whole resource, use its cursor list.

Last updated:

On this page