List Products
Retrieve all products with pagination and filtering.
Updated
On this page
Overview
Fetch a paginated list of products from your store. This is the primary endpoint for building product listing pages, category pages, and search results.
SDK Usage
import dash from "@/lib/dash"
const { products, pagination } = await dash.products.list({
limit: 20,
offset: 0,
})
// products = [{ id, name, slug, price, main_image, ... }, ...]
// pagination = { total: 150, limit: 20, offset: 0, has_more: true }
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 20 | Products per page (max 100) |
offset | number | 0 | Number of products to skip |
category | string | — | Filter by category slug |
brand | string | — | Filter by brand slug |
search | string | — | Search by product name |
include | string | — | Comma-separated product slugs to include |
customFields | object | — | Filter by custom field values |
expand | string | — | Include additional data (e.g. "sizes") |
Filtering Examples
By Category
const { products } = await dash.products.list({
category: "edibles",
})
By Search Query
const { products } = await dash.products.list({
search: "blue dream",
})
By Custom Fields
const { products } = await dash.products.list({
customFields: { featured: "true", type: "flower" },
})
Product Object
Each product in the list contains:
{
"id": "prod_abc123",
"name": "Blue Dream",
"slug": "blue-dream",
"short_name": "Blue Dream",
"main_image": "https://cdn.dashfordevs.com/...",
"price": "29.99",
"discounted_price": "24.99",
"in_stock": true,
"avg_rating": 4.7,
"reviews_count": 42,
"category": { "id": "cat_xyz", "name": "Flower", "slug": "flower" },
"custom_fields": { "type": "flower", "featured": "true" },
"main_size": {
"id": "size_123",
"label": "1g",
"price": "29.99",
"discounted_price": "24.99",
"stock": 50,
"image": null
}
}
REST API
GET /storefront/products?limit=20&offset=0&category=flower&search=blue
X-API-Key: pk_live_your_key
Server Component Example
// app/products/page.tsx
import dash from "@/lib/dash"
import { ProductCard } from "@/components/ProductCard"
export default async function ProductsPage({ searchParams }) {
const { products, pagination } = await dash.products.list({
limit: 20,
offset: Number(searchParams.offset) || 0,
category: searchParams.category,
search: searchParams.q,
})
return (
<div className="grid grid-cols-2 md:grid-cols-4 gap-4">
{products.map(p => <ProductCard key={p.id} product={p} />)}
</div>
)
}
Next Steps
- Get Product by Slug — Fetch a single product's full details
- Search & Filters — Advanced filtering options
- List Categories — Get categories for navigation