API Reference
Products
Product lookup, filtered listing, and cross-entity search.
Methods
Get
Use: products.get(slugOrPath, options?).
| Parameter | Type | Required | Description |
|---|---|---|---|
slugOrPath | string | Required | Product slug (shoe-123) or full path (/product/shoe-123). |
options | RequestOptions | Optional | Per-request controls. |
Returns: SazitoResponse<Product>.
List
Use: products.list(filters?, options?).
| Field | Type | Required | Description |
|---|---|---|---|
filters.page | number | Optional | Page number. |
filters.pageSize | number | Optional | Items per page. |
filters.sort | 'newest' | 'best-selling' | 'availability' | 'discount' | '!price' | 'price' | Optional | Sort strategy. |
filters.categories | number | number[] | Optional | Category filter(s). |
filters.priceMin | number | Optional | Minimum price. |
filters.priceMax | number | Optional | Maximum price. |
filters.availableOnly | boolean | Optional | Stock filter behavior. |
filters.discountedOnly | boolean | Optional | Discounted products only. |
filters.pinnedIds | number[] | Optional | Pin products on top. |
filters.similarTo | number | Optional | Similar-to product ID. |
options | RequestOptions | Optional | Per-request controls. |
Returns: SazitoResponse<PaginatedResponse<Product>>.
Search
Use: products.search(query, filters?, options?).
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Required | Search text. |
filters | ProductFilters | Optional | Search pagination/filter parameters. |
options | RequestOptions | Optional | Per-request controls. |
Returns: SazitoResponse<SearchResponse>.
Response key fields
Product
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Required | Product name. |
url | string | Required | Product URL path. |
enabled | boolean | Required | Enabled status. |
variants | ProductVariant[] | Required | Variant list. |
images | Image[] | Required | Product images. |
categories | ProductCategory[] | Required | Product categories. |
attributes | ProductAttribute[] | Optional | Additional attributes. |
Known errors
| Type | When it happens |
|---|---|
api | Resolved entity is not a product or product not found. |
network | Connectivity/timeout issues. |
Examples
// app/lib/sazito-client.ts
import { createSazitoClient } from '@sazito/client-sdk';
export const sazito = createSazitoClient({
domain: process.env.NEXT_PUBLIC_SAZITO_DOMAIN!,
});// app/[lang]/(home)/page.tsx
'use client';
import { useEffect, useState } from 'react';
import { sazito } from '@/app/lib/sazito-client';
export default function Example() {
const [data, setData] = useState<any>(null);
useEffect(() => {
sazito.products.list({ page: 1, pageSize: 12 }).then((res) => setData(res.data ?? null));
}, []);
return <pre>{JSON.stringify(data, null, 2)}</pre>;
}Type Details
The following tables are generated from SDK TypeScript types and include nested object fields.
ProductFilters
Source: src/types/product.ts
| Field | Type | Required |
|---|---|---|
page | number | Optional |
pageSize | number | Optional |
sort | ProductSort | Optional |
categories | number | number[] | Optional |
priceMin | number | Optional |
priceMax | number | Optional |
availableOnly | boolean | Optional |
discountedOnly | boolean | Optional |
pinnedIds | number[] | Optional |
similarTo | number | Optional |
Product
Source: src/types/product.ts
| Field | Type | Required |
|---|---|---|
id | number | Optional |
name | string | Required |
url | string | Required |
enabled | boolean | Required |
productType | string | Required |
themeConfig | any | Optional |
dynamicFormId | number | Optional |
eventEntityId | number | Optional |
attributes | ProductAttribute[] | Optional |
images | Image[] | Required |
variants | ProductVariant[] | Required |
categories | ProductCategory[] | Required |
createdAt | string | Required |
updatedAt | string | Required |
ProductVariant
Source: src/types/product.ts
| Field | Type | Required |
|---|---|---|
id | number | Required |
productId | number | Optional |
sku | string | Optional |
enabled | boolean | Required |
price | number | Required |
originalPrice | number | Optional |
stockQuantity | number | Required |
isStockManaged | boolean | Required |
isAvailable | boolean | Optional |
attributes | ProductAttribute[] | Required |
hasMaxOrder | boolean | Required |
maxOrderQuantity | number | Required |
minOrderQuantity | number | Required |
weight | number | Optional |
dynamicFormId | number | Optional |
sortIndex | number | Required |
imageId | number | Optional |
commercialFiles | any[] | Optional |
createdAt | string | Required |
updatedAt | string | Required |
ProductCategory
Source: src/types/product.ts
| Field | Type | Required |
|---|---|---|
id | number | Optional |
name | string | Required |
url | string | Required |
enabled | boolean | Optional |
description | string | Optional |
productsCount | number | Optional |
themeConfig | any | Optional |
attributes | ProductAttribute[] | Optional |
createdAt | string | Optional |
updatedAt | string | Optional |
ProductAttribute
Source: src/types/common.ts
| Field | Type | Required |
|---|---|---|
name | string | Required |
value | string | Required |
Image
Source: src/types/common.ts
| Field | Type | Required |
|---|---|---|
id | number | Required |
name | string | Required |
url | string | Required |
alt | string | Optional |
width | number | Optional |
height | number | Optional |
order | number | Optional |
createdAt | string | Required |
updatedAt | string | Required |
SearchResponse
Source: src/types/search.ts
| Field | Type | Required |
|---|---|---|
products | { items: Product[]; total: number; page: number; pageSize: number; } | Required |
products.items | Product[] | Required |
products.total | number | Required |
products.page | number | Required |
products.pageSize | number | Required |
blogPages | { items: BlogPage[]; total: number; page: number; pageSize: number; } | Required |
blogPages.items | BlogPage[] | Required |
blogPages.total | number | Required |
blogPages.page | number | Required |
blogPages.pageSize | number | Required |
cmsPages | { items: CmsPage[]; total: number; page: number; pageSize: number; } | Required |
cmsPages.items | CmsPage[] | Required |
cmsPages.total | number | Required |
cmsPages.page | number | Required |
cmsPages.pageSize | number | Required |
productCategories | { items: ProductCategory[]; total: number; page: number; pageSize: number; } | Required |
productCategories.items | ProductCategory[] | Required |
productCategories.total | number | Required |
productCategories.page | number | Required |
productCategories.pageSize | number | Required |