Create or replace products
You can create different types of products, such as simple products and configurable products.
When creating products:
- Each product requires a unique SKU identifier.
- Products must have a defined catalog source, for example locale.
- Add values for the required name, slug, and status fields.
- Define optional fields such as descriptions, images, and custom attributes as needed.
- Use the links field to define relationships between products, such as linking a product variant to its parent configurable product.
- You can create multiple products in a single request, and also create product variants for configurable products in the same request.
- Use the routes field to set category paths. The path value must match an existing category slug, for example men/clothing.
- Create a route for each category path. For example to include a product in each of the following categories men, men/clothing, and men/clothing/pants, specify three path values, one for each category.
Use the <strong>update operation</strong> to modify values for an existing product.
<h3 id="configurableProducts">Configurable products</h3>A configurable product is a parent product that allows customers to select from multiple predefined attributes such as color, size, and material. Each unique combination of these attribute values (for example, color=green, size=large) represents a product variant.
Each variant is treated as a distinct child product with its own SKU, price, and inventory. These variants are stored as separate entities in the database and linked to the parent configurable product.
The configurable product itself acts as a container or abstraction layer, enabling a unified frontend experience while maintaining granular control over each variant on the backend.
To create a configurable product, you need the following:
-
<strong>Product attributes</strong>—<a href="#operation/createProductMetadata">Create product attributes</a> (for example, "color", "size") that will be used to differentiate product variants. These attributes must be registered in the system before they can be referenced in product definitions.
-
<strong>Configurable product</strong>—Define the parent product and include a configurations array that specifies the selectable options and maps each option to a set of possible values. Each value must include a variantReferenceId, which links to a specific variant.
-
<strong>Product variants</strong>—Define a product variant for each valid combination of attribute values. Each variant must:
- Include relevant attribute values in an attributes array.
- Reference the parent configurable product using variantReferenceId.
- Include a links array with a link of type VARIANT_OF pointing to the configurable product.
For example:
<pre> { "sku": "pants-red-32", "attributes": [ { "code": "color", "values": ["Red"], "variantReferenceId": "pants-color-red" } ], "links": [ { "type": "VARIANT_OF", "sku": "pants" } ] }
Each product variant links back to the configurable product through its variantReferenceId, which corresponds to specific configurations[].values[].variantReferenceId in the configurable product.
To unassign a product variant from a configurable product, do one of the following:
- Use Delete Product API to delete the product variant.
- Use Update Product API to set the "variantReferenceId" to null and unassign the product variant from the configurable product by removing the "links" association.
A bundle product combines several simple products into one sellable unit. Items within the bundle can be categorized into logical groups like tops, bottoms, and accessories. Each group can have multiple items, and shoppers can select items from each group to create a customized bundle.
To create a bundle product, you need the following:
-
<strong>Bundle product</strong>—Define the parent product and include a bundles array that specifies the groups and items included in the bundle. Each group must define:
- group - Name of the group (for example, "tops", "bottoms")
- required - Whether a selection from this group is mandatory
- multiSelect - Whether multiple items can be selected
- items - List of products that can be selected from this group
-
<strong>Simple products</strong>—Define each simple product to include in the bundle. Each product must:
- Include a links array with a link of type IN_BUNDLE pointing to the bundle product
- Be created separately using the create product API
<strong>Note:</strong> A simple product can be included only once in each bundle. If the same item is specified in multiple groups, the API returns a Duplicate SKU found in bundle items error.
To update a bundle product, do one of the following:
- Use the Update products API to modify the groups and items in the bundle
- Use the Delete products API to remove items from the bundle
Headers
Authorization Bearer token
Use this header if the payload is compressed with gzip.
Request body
Example request
[
{
"sku": "MH01",
"source": {
"locale": "English"
},
"name": "Kangaroo Hoodie",
"slug": "kangaroo-hoodie.html",
"description": "A kangaroo hoodie for all seasons",
"shortDescription": "A hoodie for all seasons with a kangaroo pocket",
"status": "ENABLED",
"visibleIn": [
"CATALOG"
]
}
]Response
All items accepted and will be processed asynchronously