Get Product Variant Details
Retrieve detailed information about a specific product variant by its ID, including all attributes, inventory information, pricing details, and availability status.
Overview
Product variants represent different versions of a base product, such as variations in size, color, material, or other customizable attributes. Each variant is managed as a separate inventory entity with its own unique SKU, price, and stock levels - similar to how major e-commerce platforms like Amazon and Flipkart organize their product catalogs.
HTTP Method & Endpoint
GET | /product/{productId}/variant/{variantId}
Request
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
productId | String | Yes | Unique identifier of the product |
variantId | String | Yes | Unique identifier of the variant |
Response Format
Success Response (200 OK)
| Field | Type | Description |
|---|---|---|
message | String | Status message indicating the result of the operation |
data | Variant | Contains all details about the product variant |
source | String | Source of the variant data (e.g. "db") |
Examples
Javascript (React)
import axios from "axios";
import { api } from "../constant";
const fetchVariantDetails = async (productId, variantId) => {
try {
const response = await api.get(`/product/${productId}/variant/${variantId}`);
console.log("Variant details:", response.data);
} catch (error) {
console.error("Error fetching variant:", error.response?.data || error.message);
}
};
Sample Response
Click to view Sample Response
{
"message": "Variant fetched successfully",
"data": {
"productId": "30212344240120832",
"variantId": "123344",
"storeId": "30182834660443136",
"title": "Testing 1",
"description": "Good Shoes From Abibas",
"slug": "test",
"sku": "SH-1",
"subCategoryName": "Test",
"categoryName": "Test",
"originCountry": "IN",
"brandName": "tets",
"productMeasurement": {
"dimensions": {
"weight": {
"value": 150,
"unit": "grams"
},
"length": {
"value": 50,
"unit": "centimeters"
},
"width": {
"value": 25,
"unit": "centimeters"
},
"height": {
"value": 15,
"unit": "centimeters"
}
}
},
"manufacturingInfo": {
"manufacturerOrPackerName": "Aman",
"manufacturerOrPackerAddress": "surat",
"monthOfManufactureOrPacking": "02/2025"
},
"images": [
{
"position": 1,
"url": "https://test.com"
}
],
"price": 100,
"mrp": 1,
"onHand": 1,
"allocated": 1,
"attributes": {
"size": {
"name": "size",
"brand": "default",
"value": {
"value": "free size",
"displayName": "Free Size"
},
"gender": null,
"displayName": "Shirt Size | Male"
},
"color": {
"value": "red",
"hexCode": "#ifefefe",
"displayName": "red"
}
}
},
"source": "unisouk"
}
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request - Invalid product or variant ID |
| 401 | Unauthorized - Authentication token is missing or invalid |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Product or variant was not found |
| 500 | Internal Server Error - Something went wrong on the server |