Pagination
How pagination works across list endpoints.
Updated
On this page
Overview
List endpoints return paginated results. Use limit and offset parameters to page through data.
How pagination works across list endpoints.
Updated
List endpoints return paginated results. Use limit and offset parameters to page through data.
| Parameter | Type | Default | Max | Description |
|---|---|---|---|---|
limit | number | 20 | 100 | Items per page |
offset | number | 0 | — | Number of items to skip |
page | number | 1 | — | Page number (alternative to offset) |
{
"products": [...],
"pagination": {
"total": 150,
"limit": 20,
"offset": 0,
"has_more": true
}
}
let offset = 0
const limit = 20
let allProducts = []
while (true) {
const { products, pagination } = await dash.products.list({ limit, offset })
allProducts.push(...products)
if (!pagination.has_more) break
offset += limit
}
# Page 1
GET /storefront/products?limit=20&offset=0
# Page 2
GET /storefront/products?limit=20&offset=20
# Page 3
GET /storefront/products?limit=20&offset=40