---
title: "Get product by id"
method: GET
path: "/ecommerce/products/{productId}"
tags: ["🛒 Ecommerce"]
---

# Get product by id

`GET /ecommerce/products/{productId}`

The API retrieves a product based on the provided `productId` passed as a path variable.

This API serves as a means to fetch specific product information from the backend based on a unique identifier.

By passing the `productId` in the URL, the API searches and retrieves the corresponding product details, including attributes such as name, price, description, stock, images and any other relevant information associated with the product.

## Response `200`

Get product by id

- object
  - `data` object
    - `__v` number
    - `_id` string
    - `category` string
    - `createdAt` string
    - `description` string
    - `mainImage` object
      - `_id` string
      - `localPath` string
      - `url` string
    - `name` string
    - `owner` string
    - `price` number
    - `stock` number
    - `subImages` object[]
      - `_id` string
      - `localPath` string
      - `url` string
    - `updatedAt` string
  - `message` string
  - `statusCode` number
  - `success` boolean

---

[API](https://skmtc.net/hiteshchoudhary-ssesph/apis/freeapi.md) · [All operations](https://skmtc.net/hiteshchoudhary-ssesph/apis/freeapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/hiteshchoudhary-ssesph/freeapi/revisions/a9f3a290e4dc/schema)
