Products

Product management operations

Get all products

get
/products

Retrieves a list of all products.

Authorizations
Query parameters
limitintegerOptional

The number of products to return.

Default: 10
offsetintegerOptional

The number of products to skip.

Default: 0
Responses
200

A list of products.

application/json
get
/products
GET /api/v1/products HTTP/1.1
Host: localhost:3000
Accept: */*
{
  "limit": 1,
  "offset": 1,
  "total": 1,
  "products": [
    {
      "_id": "text",
      "name": "text",
      "description": "text",
      "slug": "text",
      "price": 1,
      "discountedPrice": 1,
      "stock": 1,
      "category": "text",
      "brand": "text",
      "images": [
        {
          "publicId": "text",
          "url": "text",
          "width": 1,
          "height": 1
        }
      ],
      "ratings": {
        "average": 1,
        "count": 1
      },
      "isFeatured": true,
      "retailer": "text",
      "likesCount": 1,
      "commentsCount": 1,
      "createdAt": "2025-10-21T06:01:19.680Z",
      "updatedAt": "2025-10-21T06:01:19.680Z"
    }
  ]
}

Create a new product

post
/products

Creates a new product (retailer only).

Authorizations
Body
namestringOptional
descriptionstringOptional
pricenumberOptional
discountedPricenumberOptional
stockintegerOptional
categoryIdstringOptional
brandstringOptional
isFeaturedbooleanOptional
product_imagesstring · binary[]Optional
Responses
201

Product created successfully.

application/json
post
/products
POST /api/v1/products HTTP/1.1
Host: localhost:3000
Content-Type: multipart/form-data
Accept: */*
Content-Length: 157

{
  "name": "text",
  "description": "text",
  "price": 1,
  "discountedPrice": 1,
  "stock": 1,
  "categoryId": "text",
  "brand": "text",
  "isFeatured": true,
  "product_images": [
    "binary"
  ]
}
{
  "_id": "text",
  "name": "text",
  "description": "text",
  "slug": "text",
  "price": 1,
  "discountedPrice": 1,
  "stock": 1,
  "category": "text",
  "brand": "text",
  "images": [
    {
      "publicId": "text",
      "url": "text",
      "width": 1,
      "height": 1
    }
  ],
  "ratings": {
    "average": 1,
    "count": 1
  },
  "isFeatured": true,
  "retailer": "text",
  "likesCount": 1,
  "commentsCount": 1,
  "createdAt": "2025-10-21T06:01:19.680Z",
  "updatedAt": "2025-10-21T06:01:19.680Z"
}

Get product by slug

get
/products/{slug}

Retrieves a product by its slug.

Authorizations
Path parameters
slugstringRequired

The slug of the product to retrieve.

Responses
200

The product's information.

application/json
get
/products/{slug}
GET /api/v1/products/{slug} HTTP/1.1
Host: localhost:3000
Accept: */*
{
  "_id": "text",
  "name": "text",
  "description": "text",
  "slug": "text",
  "price": 1,
  "discountedPrice": 1,
  "stock": 1,
  "category": "text",
  "brand": "text",
  "images": [
    {
      "publicId": "text",
      "url": "text",
      "width": 1,
      "height": 1
    }
  ],
  "ratings": {
    "average": 1,
    "count": 1
  },
  "isFeatured": true,
  "retailer": "text",
  "likesCount": 1,
  "commentsCount": 1,
  "createdAt": "2025-10-21T06:01:19.680Z",
  "updatedAt": "2025-10-21T06:01:19.680Z"
}

Update a product

put
/products/{productId}

Updates a product by its ID (retailer only).

Authorizations
Path parameters
productIdstringRequired

The ID of the product to update.

Body
namestringOptional
descriptionstringOptional
pricenumberOptional
discountedPricenumberOptional
stockintegerOptional
categoryIdstringOptional
brandstringOptional
isFeaturedbooleanOptional
product_imagesstring · binary[]Optional
Responses
200

Product updated successfully.

application/json
put
/products/{productId}
PUT /api/v1/products/{productId} HTTP/1.1
Host: localhost:3000
Content-Type: multipart/form-data
Accept: */*
Content-Length: 157

{
  "name": "text",
  "description": "text",
  "price": 1,
  "discountedPrice": 1,
  "stock": 1,
  "categoryId": "text",
  "brand": "text",
  "isFeatured": true,
  "product_images": [
    "binary"
  ]
}
{
  "_id": "text",
  "name": "text",
  "description": "text",
  "slug": "text",
  "price": 1,
  "discountedPrice": 1,
  "stock": 1,
  "category": "text",
  "brand": "text",
  "images": [
    {
      "publicId": "text",
      "url": "text",
      "width": 1,
      "height": 1
    }
  ],
  "ratings": {
    "average": 1,
    "count": 1
  },
  "isFeatured": true,
  "retailer": "text",
  "likesCount": 1,
  "commentsCount": 1,
  "createdAt": "2025-10-21T06:01:19.680Z",
  "updatedAt": "2025-10-21T06:01:19.680Z"
}

Delete a product

delete
/products/{productId}

Deletes a product by its ID (retailer or admin only).

Authorizations
Path parameters
productIdstringRequired

The ID of the product to delete.

Responses
204

Product deleted successfully.

No content

delete
/products/{productId}
DELETE /api/v1/products/{productId} HTTP/1.1
Host: localhost:3000
Accept: */*

No content

Get products by retailer

get
/products/retailer/{retailerId}

Retrieves a list of products for a specific retailer.

Authorizations
Path parameters
retailerIdstringRequired

The ID of the retailer.

Query parameters
limitintegerOptional

The number of products to return.

Default: 10
offsetintegerOptional

The number of products to skip.

Default: 0
Responses
200

A list of products.

application/json
get
/products/retailer/{retailerId}
GET /api/v1/products/retailer/{retailerId} HTTP/1.1
Host: localhost:3000
Accept: */*
{
  "limit": 1,
  "offset": 1,
  "total": 1,
  "products": [
    {
      "_id": "text",
      "name": "text",
      "description": "text",
      "slug": "text",
      "price": 1,
      "discountedPrice": 1,
      "stock": 1,
      "category": "text",
      "brand": "text",
      "images": [
        {
          "publicId": "text",
          "url": "text",
          "width": 1,
          "height": 1
        }
      ],
      "ratings": {
        "average": 1,
        "count": 1
      },
      "isFeatured": true,
      "retailer": "text",
      "likesCount": 1,
      "commentsCount": 1,
      "createdAt": "2025-10-21T06:01:19.680Z",
      "updatedAt": "2025-10-21T06:01:19.680Z"
    }
  ]
}