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

Headers

HeaderValueDescription
Content-Typeapplication/jsonSpecifies that the response will be in JSON format
AuthorizationBearer {token}Authentication token (replace {token} with your actual token)
x-store-id{storeId}StoreId (replace {storeId} with your actual storeId)

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
dataObjectContains all details about the product variant
sourceStringSource of the variant data (e.g. "db")

Data Object Properties

FieldTypeDescription
productIdStringParent product ID
variantIdStringUnique identifier for the variant
storeIdStringStore ID associated with the variant
titleStringProduct title
descriptionStringProduct description
slugStringURL-friendly product identifier
skuStringStock keeping unit
subCategoryNameStringProduct sub-category name
categoryNameStringProduct category name
originCountryStringCountry of origin (ISO country code)
brandNameStringBrand name of the product
productMeasurementObjectPhysical dimensions and weight of the product
manufacturingInfoObjectManufacturing/packaging details
imagesArrayList of variant images
priceNumberCurrent selling price
mrpNumberMaximum retail price
onHandNumberQuantity available in inventory
allocatedNumberQuantity reserved in orders
attributesObjectVariant-specific attributes

Product Measurement Properties

FieldTypeDescription
dimensionsObjectPhysical dimensions of product
Dimensions Properties
FieldTypeDescription
weightObjectProduct weight
lengthObjectProduct length
widthObjectProduct width
heightObjectProduct height
Measurement Unit Properties
FieldTypeDescription
valueNumberMeasurement value
unitStringUnit of measurement

Manufacturing Info Properties

FieldTypeDescription
manufacturerOrPackerNameStringName of manufacturer/packer
manufacturerOrPackerAddressStringAddress of manufacturer/packer
monthOfManufactureOrPackingStringManufacturing/packing date

Image Properties

FieldTypeDescription
positionNumberDisplay order of image
urlStringURL of the image

Attribute Properties

FieldTypeDescription
SizeSizeColor hex code (for colors)
ColorColorColor hex code (for colors)

Size Attribute

FieldTypeDescription
nameStringAttribute name
brandStringBrand-specific attribute
valueObjectAttribute value
genderMale,FemaleGender specification (if any)
displayNameStringUser-friendly attribute name

Color Attribute

FieldTypeDescription
valueObject/StringAttribute value
displayNameStringUser-friendly attribute name
hexCodeStringColor 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 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