Skip to main content

Pagination

All list endpoints return paginated results with a consistent format.

Query Parameters​

ParamTypeDefaultDescription
pagenumber1Page number (1-based)
limitnumber20Items per page (max 250)
sortBystringcreated_atField to sort by
sortOrderstringdescasc or desc
GET /stores/:storeId/products?page=2&limit=50&sortBy=title&sortOrder=asc

Response Format​

Every paginated response includes the same envelope:

{
"data": [
{ "id": "prod_abc123", "title": "Product A" },
{ "id": "prod_def456", "title": "Product B" }
],
"total": 150,
"page": 2,
"limit": 50,
"totalPages": 3
}
FieldDescription
dataArray of resource objects
totalTotal number of matching records
pageCurrent page number
limitItems per page
totalPagesTotal number of pages

SDK Usage​

Manual Pagination​

const page1 = await tanqory.products.list(storeId, { page: 1, limit: 50 })
console.log(page1.total) // 150
console.log(page1.totalPages) // 3

const page2 = await tanqory.products.list(storeId, { page: 2, limit: 50 })

Auto-Pagination​

Use listAll() to iterate through every page automatically:

for await (const product of tanqory.products.listAll(storeId)) {
console.log(product.title)
}

The SDK fetches the next page when the current page is exhausted. This works on all list endpoints:

for await (const order of tanqory.orders.listAll(storeId, { status: 'UNFULFILLED' })) {
await processOrder(order)
}

Collect All Results​

const allProducts: Tanqory.Product[] = []
for await (const product of tanqory.products.listAll(storeId)) {
allProducts.push(product)
}

Sorting​

Common sortable fields by resource:

ResourcesortBy values
Productscreated_at, updated_at, title, price, inventory
Orderscreated_at, updated_at, total, order_number
Customerscreated_at, updated_at, name, orders_count, total_spent