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
Headers
| Header | Value | Description |
|---|---|---|
Content-Type | application/json | Specifies that the response will be in JSON format |
Authorization | Bearer {token} | Authentication token (replace {token} with your actual token) |
x-store-id | {storeId} | StoreId (replace {storeId} with your actual storeId) |
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 | Object | Contains all details about the product variant |
source | String | Source of the variant data (e.g. "db") |
Data Object Properties
| Field | Type | Description |
|---|---|---|
productId | String | Parent product ID |
variantId | String | Unique identifier for the variant |
storeId | String | Store ID associated with the variant |
title | String | Product title |
description | String | Product description |
slug | String | URL-friendly product identifier |
sku | String | Stock keeping unit |
subCategoryName | String | Product sub-category name |
categoryName | String | Product category name |
originCountry | String | Country of origin (ISO country code) |
brandName | String | Brand name of the product |
productMeasurement | Object | Physical dimensions and weight of the product |
manufacturingInfo | Object | Manufacturing/packaging details |
images | Array | List of variant images |
price | Number | Current selling price |
mrp | Number | Maximum retail price |
onHand | Number | Quantity available in inventory |
allocated | Number | Quantity reserved in orders |
attributes | Object | Variant-specific attributes |
Product Measurement Properties
| Field | Type | Description |
|---|---|---|
dimensions | Object | Physical dimensions of product |
Dimensions Properties
| Field | Type | Description |
|---|---|---|
weight | Object | Product weight |
length | Object | Product length |
width | Object | Product width |
height | Object | Product height |
Measurement Unit Properties
| Field | Type | Description |
|---|---|---|
value | Number | Measurement value |
unit | String | Unit of measurement |
Manufacturing Info Properties
| Field | Type | Description |
|---|---|---|
manufacturerOrPackerName | String | Name of manufacturer/packer |
manufacturerOrPackerAddress | String | Address of manufacturer/packer |
monthOfManufactureOrPacking | String | Manufacturing/packing date |
Image Properties
| Field | Type | Description |
|---|---|---|
position | Number | Display order of image |
url | String | URL of the image |
Attribute Properties
| Field | Type | Description |
|---|---|---|
Size | Size | Color hex code (for colors) |
Color | Color | Color hex code (for colors) |
Size Attribute
| Field | Type | Description |
|---|---|---|
name | String | Attribute name |
brand | String | Brand-specific attribute |
value | Object | Attribute value |
gender | Male,Female | Gender specification (if any) |
displayName | String | User-friendly attribute name |
Color Attribute
| Field | Type | Description |
|---|---|---|
value | Object/String | Attribute value |
displayName | String | User-friendly attribute name |
hexCode | String | Color hex code (for colors) |
These separate tables make it easier to understand the structure of each attribute type in your product variant system. You can include these in your Docusaurus documentation to provide a clearer explanation of your attribute properties.
Examples
cURL
curl -X GET "https://dev-sfapi.unisouk.com/product/30212344240120832/variant/123344" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <TOKEN>" \
-H "x-store-id: <STORE_ID>"
Javascript (React)
import axios from "axios";
const fetchVariantDetails = async (productId, variantId) => {
try {
const response = await axios.get(`https://dev-sfapi.unisouk.com/product/${productId}/variant/${variantId}`, {
headers: {
"Content-Type": "application/json",
Authorization: "Bearer <TOKEN>",
"x-store-id": "<STORE_ID>",
},
});
console.log("Variant details:", response.data);
} catch (error) {
console.error("Error fetching variant:", error.response?.data || error.message);
}
};
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 |