Skip to main content

Version: v1

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​

ParameterTypeRequiredDescription
productIdStringYesUnique identifier of the product
variantIdStringYesUnique identifier of the variant

Response Format​

Success Response (200 OK)​

FieldTypeDescription
messageStringStatus message indicating the result of the operation
dataVariantContains all details about the product variant
sourceStringSource 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 CodeDescription
400Bad Request - Invalid product or variant ID
401Unauthorized - Authentication token is missing or invalid
403Forbidden - Insufficient permissions
404Not Found - Product or variant was not found
500Internal Server Error - Something went wrong on the server