Requires
read_product
access scope. More access scope
The Variant List By SKU API allows users to retrieve all product variants associated with a specific SKU. This endpoint is useful for identifying variants under the same SKU, enabling efficient management and troubleshooting of product variants.This API is especially useful for:
- Retrieve all variants under the same SKU to manage grouped products effectively.
- Support inventory and pricing adjustments for products sharing the same SKU.
Note: The operation is scoped to a specific shop, identified by its unique domain prefix (shopdomain), ensuring all updates are applied to the correct store.
Public Request Parameters
Parameter Name | Type | Required | Parameter Location | Parameter Value | Description |
---|---|---|---|---|---|
Access-Token | String | Yes | Header | Bx-_5aV eXNwl-4AB98s5xLV yg0fNzGf MuTpqtlBA | Used to authenticate API requests. Obtain an access token from the Access Token Guide. Pass it in the Authorization header for every request. |
Content-Type | String | Yes | Header | application /json | Indicates the media type of the request body. It tells the server how to parse the request and the client how to interpret the response. For more details, visit Content-Type. |
Public Response Parameters
Parameter Name | Type | Mandatory | Parameter Location | Example Value | Description |
---|---|---|---|---|---|
error | String | No | Response Body | { "error": "store is not active" } | Indicates an error encountered during the process. This field typically appears when the Access Token is missing or invalid. Example: { "error": "store is not active" } . |
errors | Array | No | Response Body | { "errors"["No Context"] } | A list of errors that occurred during the request processing. Example: { "errors": [ "No Context" ] } . |
Request-Id | String | Yes | Header | Bx-_5aV eXNwl-4AB98s5xLV yg0fNzGf MuTpqtlBA | A unique identifier for each request. It helps in identifying and debugging specific requests. |
Error and Errors Clarification:
Added explanation that the error and errors fields are currently dependent on the API implementation, with plans for future unification.
Request Parameters
Path Parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
sku | string | Yes | "ABC123" | SKU of the product to retrieve variants. |
Response Explanation
Successful Response
Field | Type | Example | Description |
---|---|---|---|
variants | array | array of variant object | |
variants[ ].id | string | 1b735278-62c7-41ad-9976-b1b63a90590d | Unique identifier for the variant. |
variants[ ].product_id | string | 636a07da-39eb-4829-bde9-b65fae1c28b0 | Unique identifier for the associated product. |
variants[ ].image_id | string | 91d032e7-bbc8-47e4-8668-9ba6fe714de6 | Unique identifier for the associated image. |
variants[ ].created_at | string (date) | 2024-04-15T02:00:57Z | Timestamp indicating when the variant was created. |
variants[ ].updated_at | string (date) | 2024-04-15T02:00:57Z | Timestamp indicating when the variant was last updated. |
variants[ ].title | string | S-red | Title of the variant. |
variants[ ].option1 | string | S | First option value for the variant (e.g., size). |
variants[ ].option2 | string | red | Second option value for the variant (e.g., color). |
variants[ ].option3 | string | "" | Third option value for the variant, if applicable. |
variants[ ].image | object | Image Object | |
variants[ ].image.src | string | //cdn.shoplazza.com/efd33b921cacd5311a32dd03a9bc8740.png | URL of the image associated with the variant. |
variants[ ].image.width | integer | 1588 | Width of the variant image in pixels. |
variants[ ].image.height | integer | 2246 | Height of the variant image in pixels. |
variants[ ].image.path | string | efd33b921cacd5311a32dd03a9bc8740.png | File path of the variant image. |
variants[ ].image.alt | string | "" | Alternative text for the variant image. |
variants[ ].position | integer | 1 | Position of the variant in the product's variant list. |
variants[ ].compare_at_price | string | 100.00 | Original price of the variant before discounts. |
variants[ ].price | string | 100.00 | Current price of the variant. |
variants[ ].sku | string | S-RED | Stock Keeping Unit (SKU) for the variant. |
variants[ ].barcode | string | 123 | Barcode associated with the variant. |
variants[ ].note | string | s-red | Notes or additional information about the variant. |
variants[ ].inventory_quantity | integer | 10 | Number of items available in inventory for the variant. |
variants[ ].weight | string | 0.10 | Weight of the variant. |
variants[ ].weight_unit | string | kg | Unit of measurement for the weight (e.g., kg, lb). |
variants[ ].cost_price | string | 11.00 | Cost price of the variant. |
variants[ ].wholesale_price | object | wholesale price object | |
variants[].wholesale_price.price | string | 100.00 | Wholesale price for the variant. |
variants[].wholesale_price.min_quantity | integer | 1 | Minimum quantity required to avail the wholesale price. |
variants[ ].extend | object | extend object | Additional details about the variant's dimensions or origin. |
variants[ ].extend.length | number | 10 | length |
variants[ ].extend.width | number | 10 | width |
variants[ ].extend.height | number | 10 | height |
variants[ ].extend.dimension_unit | string | "in" | dimension_unit |
variants[ ].extend.origin_country_code | string | "AS" | Country of origin code of the product. |
variants[ ].extend.hs_code | string | "6211439" | HS codes are the international standard for commodity classification, and Shoplazza can automatically generate HS codes based on commodity information. |
Error Response
Error responses in the API can be represented using two different fields: errors
and error
. Both fields provide details about issues encountered during request processing. Below is an explanation of the fields with their respective examples and descriptions.
Field | Type | Example | Description |
---|---|---|---|
errors | Array | ["No Context"] | A list of errors encountered during the request processing. |
Field | Type | Example | Description |
---|---|---|---|
error | Array | "store is not active" | Indicates an error encountered during the process. |
Request Examples
curl --request GET \
--url https://shopdomain.myshoplaza.com/openapi/2022-01/products/sku/T-M-S-blue-T-A001004/variants \
--header 'accept: application/json' \
--header 'access-token: WPMSdB6M8Cpum4X1GoMYOKZpiESd8d2x7dZW8d79ZeQ'
Success Response Example
{
"variants": [
{
"id": "88e68830-4ef5-4125-bf7d-aef8047176b2",
"product_id": "a1a88be0-a1d4-47e4-a2f2-ba6e131cf447",
"image_id": "8ef098c5-5a08-44b4-b5fb-89214bb507dc",
"created_at": "2024-04-17T02:15:18Z",
"updated_at": "2024-04-17T02:15:18Z",
"title": "S-blue-T",
"option1": "S",
"option2": "blue",
"option3": "T",
"image": {
"src": "//cdn.shoplazza.com/ccf0794c594bad32a320eea0d6bfe40c.jpeg",
"width": 174,
"height": 180,
"path": "ccf0794c594bad32a320eea0d6bfe40c.jpeg",
"alt": ""
},
"position": 1,
"compare_at_price": "12.10",
"price": "10.10",
"sku": "T-M-S-blue-T-A001004",
"barcode": "6929000212340",
"note": "node",
"inventory_quantity": 10,
"weight": "1.10",
"weight_unit": "kg",
"cost_price": "1.10",
"wholesale_price": [
{
"price": "10.10",
"min_quantity": 1
}
],
"extend": {
"length": 10,
"width": 10,
"height": 10,
"dimension_unit": "in",
"origin_country_code": "AG",
"hs_code": "62114390"
}
}
]
}
Error Response Example
{
"errors": [
"No Context"
]
}
{
"error": "store is not active"
}
Error Details
Response Explanation
Product Response Fields
Status Code | Message | Possible Reason | Example Response |
---|---|---|---|
400 | Bad Request | Invalid input format or request structure (e.g., missing required fields or incorrect data types). | Bad Request |
Unauthorized | The request is missing valid authentication credentials or the credentials provided are invalid. | Unauthorized |