Variant List

🔒

Requires read_product access scope. More access scope

The Variant List API retrieves a list of variants associated with a specified product. By providing a valid product_id in the path parameter, users can fetch detailed information about the variants linked to a particular product. Ensure the product_id is valid and properly formatted as a UUID to avoid errors.This API is especially useful for:

  1. Retrieve all variants of a specific product to display options such as size, color, or other attributes.
  2. Fetch variant details to support inventory and pricing management.

Request Parameters

Public Request Parameters

📘

Public Request Parameters

Path Parameters

ParameterTypeRequiredExampleDescription
product_idstringYes9fb9f3c6-2300-42c1-8593-d9008d7cfc09The unique identifier for the product.

Response Explanation

Public Response Parameters

📘

Public Response Parameters

Successful Response

Parameter Type Required Example Description
variants array - array of variant object
variants[ ].id string Yes 1b735278-62c7-41ad-9976-b1b63a90590d Unique identifier for the variant.
variants[ ].product_id string Yes 636a07da-39eb-4829-bde9-b65fae1c28b0 Unique identifier for the associated product.
variants[ ].image_id string No 91d032e7-bbc8-47e4-8668-9ba6fe714de6 Unique identifier for the associated image.
variants[ ].created_at string (date) No 2024-04-15T02:00:57Z Timestamp indicating when the variant was created.
variants[ ].updated_at string (date) No 2024-04-15T02:00:57Z Timestamp indicating when the variant was last updated.
variants[ ].title string No S-red Title of the variant.
variants[ ].option1 string No S First option value for the variant (e.g., size).
variants[ ].option2 string No red Second option value for the variant (e.g., color).
variants[ ].option3 string No "" Third option value for the variant, if applicable.
variants[ ].image object No Image Object
variants[ ].image.src string No //cdn.shoplazza.com/efd33b921cacd5311a32dd03a9bc8740.png URL of the image associated with the variant.
variants[ ].image.width integer No 1588 Width of the variant image in pixels.
variants[ ].image.height integer No 2246 Height of the variant image in pixels.
variants[ ].image.path string No efd33b921cacd5311a32dd03a9bc8740.png File path of the variant image.
variants[ ].image.alt string No "" Alternative text for the variant image.
variants[ ].position integer Yes 1 Position of the variant in the product's variant list.
variants[ ].compare_at_price string No 100.00 Original price of the variant before discounts.
variants[ ].price string Yes 100.00 Current price of the variant.
variants[ ].sku string No S-RED Stock Keeping Unit (SKU) for the variant.
variants[ ].barcode string No 123 Barcode associated with the variant.
variants[ ].note string No s-red Notes or additional information about the variant.
variants[ ].inventory_quantity integer No 10 Number of items available in inventory for the variant.
variants[ ].weight string No 0.10 Weight of the variant.
variants[ ].weight_unit string No kg Unit of measurement for the weight (e.g., kg, lb).
variants[ ].cost_price string No 11.00 Cost price of the variant.
variants[ ].wholesale_price object No wholesale price object
variants[ ].wholesale_price.price string No 100.00 Wholesale price for the variant.
variants[ ].wholesale_price.min_quantity integer No 1 Minimum quantity required to avail the wholesale price.
variants[ ].extend object No extend object Additional details about the variant's dimensions or origin.
variants[ ].extend.length number No 10 length
variants[ ].extend.width number No 10 width
variants[ ].extend.height number No 10 height
variants[ ].extend.dimension_unit string No "in" dimension_unit
variants[ ].extend.origin_country_code string No "AS" Country of origin code of the product.
variants[ ].extend.hs_code string No "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.

FieldTypeExampleDescription
errorsArray["Context"]A list of errors encountered during the request processing.
FieldTypeExampleDescription
errorArray "store is not active"Indicates an error encountered during the process.

Error Details

Status CodeMessagePossible ReasonExample Response
400Bad RequestInvalid input format or request structure (e.g., missing required fields or incorrect data types).Bad Request
UnauthorizedThe request is missing valid authentication credentials or the credentials provided are invalid.Unauthorized
404Product Not FoundThe product ID provided in the request does not exist.{ "errors": ["Product not found"] }
422Invalid or empty product_idmissing required product_id or product_id with incorrect UUID types{ "errors": [ "productId has an invalid UUID"]}

API Structure Overview

Language
Credentials
Header
URL
Click Try It! to start a request and see the response here!