Skip to main content

Products API

Base path: /api/products
File: ayts-api/src/routes/products.ts

GET /api/products

List products with filters.

Query params:

ParamTypeDescription
storeIdUUIDFilter by store
categorystringFilter by category
statusavailable|out_of_stock|archivedFilter by availability
minPricenumberPrice range filter
maxPricenumberPrice range filter
limitnumberPage size (default: 20)
offsetnumberPagination offset

Response 200:

{
"success": true,
"products": [{
"id": "uuid",
"storeId": "uuid",
"name": "Sinandomeng Rice 5kg",
"description": "...",
"price": 285.00,
"stockCount": 50,
"category": "staples",
"status": "available",
"imageUrl": "https://r2...",
"additionalImages": [],
"store": { "name": "Fresh Mart Grocery", "id": "uuid" }
}],
"total": 120
}

GET /api/products/:id

Get a single product with full details, reviews, and store info.


POST /api/products

Create a product. Requires vendor (own store) or admin role.

{
"storeId": "uuid",
"name": "Sinandomeng Rice 5kg",
"description": "Premium quality rice",
"price": 285.00,
"stockCount": 50,
"category": "staples",
"status": "available",
"imageUrl": "https://r2...",
"additionalImages": ["https://r2..."]
}

PATCH /api/products/:id

Update a product. Requires owner or admin.


DELETE /api/products/:id

Archive a product (soft delete). Requires owner or admin.


PATCH /api/products/:id/stock

Update stock count only.

{ "stockCount": 45 }