Config Product Creation
This API is offering to create Configurable Product.
Create Simple (Child) Product
POST {{Base_url}}/rest/V1/products
Body
{
"product": {
"sku": "simple-product-sku1_color",
"name": "Simple Product 1",
"price": 50,
"status": 1,
"type_id": "simple",
"attribute_set_id": 92,
"visibility": 1,
"extension_attributes": {
"stock_item": {
"qty": 100,
"is_in_stock": true
}
},
"custom_attributes": [
{
"attribute_code": "color_dropdown",
"value": "1922" //Color Dropdown ID
}
]
}
}curl --location '{{Base_url}}/rest/V1/products' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJraWQiOiIxIiwiYWxnIjoiSFMyNTYifQ.eyJ1aWQiOjU1LCJ1dHlwaWQiOjIsImlhdCI6MTczNjc1NDI3OSwiZXhwIjoxNzM2NzU3ODc5fQ.Fh_EDGygLD_8KVVV42qHv5DCVXsx5012T-jSd75Pfj4' \
--header 'Cookie: PHPSESSID=6t4unirh1unu87ef0stp2sv3kv; private_content_version=5ab80b7def0c212f723edead3c971a19' \
--data '{
"product": {
"sku": "simple-product-sku1_color",
"name": "Simple Product 1",
"price": 50,
"status": 1,
"type_id": "simple",
"attribute_set_id": 92,
"visibility": 1,
"extension_attributes": {
"stock_item": {
"qty": 100,
"is_in_stock": true
}
},
"custom_attributes": [
{
"attribute_code": "color_dropdown",
"value": "1922"
}
]
}
}'Product JSON Object Explanation
"product"
Root object representing the product data being created.
Attributes in product:
"sku"Type: String.
Unique identifier for the product, e.g.,
"simple-product-sku1_color".
"name"Type: String.
The product's name, e.g.,
"Simple Product 1".
"price"Type: Float.
The product's price, e.g.,
50.
"status"Type: Integer.
Product status:
1for enabled,0for disabled.
"type_id"Type: String.
Product type, e.g.,
"simple"for a simple product.
"attribute_set_id"Type: Integer.
ID of the attribute set to which this product belongs (e.g.,
92).
"visibility"Type: Integer.
Visibility on the storefront:
1: Not visible individually.2: Catalog only.3: Search only.4: Catalog and search.
Extension Attributes
"stock_item"
Represents stock and inventory data:
"qty": Quantity in stock, e.g.,100."is_in_stock": Boolean to indicate if the product is in stock (trueorfalse).
Custom Attributes
"custom_attributes"
A list of additional attributes for the product:
"attribute_code": Identifier for the attribute (e.g.,"color_dropdown")."value": Value for the attribute (e.g.,"1922", which might represent a color ID).
Responses
{
"id": 14602,
"sku": "simple-product-sku1_color",
"name": "Simple Product 1",
"attribute_set_id": 92,
"price": 50,
"status": 1,
"visibility": 1,
"type_id": "simple",
"created_at": "2025-01-10 11:49:09",
"updated_at": "2025-01-13 07:51:39",
"extension_attributes": {
"website_ids": [
1
],
"stock_item": {
"item_id": 432290,
"product_id": 14602,
"stock_id": 1,
"qty": 100,
"is_in_stock": true,
"is_qty_decimal": false,
"show_default_notification_message": false,
"use_config_min_qty": true,
"min_qty": 0,
"use_config_min_sale_qty": 1,
"min_sale_qty": 1,
"use_config_max_sale_qty": true,
"max_sale_qty": 100,
"use_config_backorders": true,
"backorders": 0,
"use_config_notify_stock_qty": true,
"notify_stock_qty": 1,
"use_config_qty_increments": true,
"qty_increments": 0,
"use_config_enable_qty_inc": true,
"enable_qty_increments": false,
"use_config_manage_stock": true,
"manage_stock": true,
"low_stock_date": null,
"is_decimal_divided": false,
"stock_status_changed_auto": 0
}
},
"options": [],
"media_gallery_entries": [],
"custom_attributes": [
{
"attribute_code": "url_key",
"value": "simple-product-1"
},
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "purchase_price_cap",
"value": "0.000000"
},
{
"attribute_code": "msrp_display_actual_price_type",
"value": "0"
},
{
"attribute_code": "is_sclp",
"value": "0"
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "has_options",
"value": "0"
},
{
"attribute_code": "popular_product",
"value": "0"
},
{
"attribute_code": "tax_class_id",
"value": "2"
},
{
"attribute_code": "category_ids",
"value": []
},
{
"attribute_code": "sw_featured",
"value": "0"
},
{
"attribute_code": "color_dropdown",
"value": "1922"
}
]
}Top-Level Attributes
idType: Integer.
Unique identifier for the product in Magento (e.g.,
14602).
skuType: String.
Stock Keeping Unit (unique product identifier) used for inventory and management (e.g.,
"simple-product-sku1_color").
nameType: String.
The product name displayed to customers (e.g.,
"Simple Product 1").
attribute_set_idType: Integer.
ID of the attribute set associated with this product (e.g.,
92). Attribute sets define the attributes available for the product.
priceType: Float.
Base price of the product (e.g.,
50).
statusType: Integer.
Indicates whether the product is enabled (
1) or disabled (0) in the store.
visibilityType: Integer.
Product visibility setting:
1: Not visible individually.2: Catalog only.3: Search only.4: Catalog and search.
type_idType: String.
Specifies the product type. Here,
"simple"indicates a simple product.
created_atType: String (timestamp).
Timestamp for when the product was created (
"2025-01-10 11:49:09").
updated_atType: String (timestamp).
Timestamp for when the product was last updated (
"2025-01-13 07:51:39").
extension_attributes
extension_attributeswebsite_idsType: Array.
IDs of the websites where this product is available (e.g.,
[1]).
stock_itemDetails about stock and inventory for this product:
item_id: Unique stock item ID (e.g.,432290).product_id: ID of the product associated with this stock item (e.g.,14602).stock_id: ID of the stock (e.g.,1).qty: Quantity in stock (e.g.,100).is_in_stock: Indicates if the product is in stock (true).is_qty_decimal: Whether the product allows fractional quantities (false).use_config_*: Boolean flags indicating if stock-related configurations are using global settings.min_qty: Minimum stock quantity (e.g.,0).max_sale_qty: Maximum quantity that can be purchased in one order (e.g.,100).backorders: Backorder settings (0for no backorders).notify_stock_qty: Threshold for low stock notification (e.g.,1).manage_stock: Indicates if stock management is enabled (true).
options
optionsType: Array.
Additional product options (empty here).
media_gallery_entries
media_gallery_entriesType: Array.
Media (images, videos) associated with the product (empty here).
custom_attributes
custom_attributesurl_keyURL-friendly identifier for the product (e.g.,
"simple-product-1").
options_containerDefines where product options are displayed on the product page (e.g.,
"container2").
purchase_price_capReserved for managing purchase price limits (e.g.,
"0.000000").
msrp_display_actual_price_typeDetermines how MSRP (Manufacturer Suggested Retail Price) is displayed (e.g.,
"0").
is_sclpCustom attribute, possibly related to product-specific logic (e.g.,
"0").
required_optionsIndicates if the product has required options (
"0"means no required options).
has_optionsIndicates if the product has any custom options (
"0"means no options).
popular_productCustom attribute to flag popular products (e.g.,
"0").
tax_class_idID of the tax class applied to the product (e.g.,
"2").
category_idsList of category IDs to which the product belongs (empty here).
sw_featuredCustom attribute, possibly related to featured products (
"0").
color_dropdownCustom attribute for color, storing a value that corresponds to an option ID (e.g.,
"1922").
{
"message": "The \"sku\" attribute value is empty. Set the attribute and try again."
}{
"message": "The consumer isn't authorized to access %resources."
}Create Config (Parent) Product
POST {{Base_url}}/rest/V1/products
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
{
"product": {
"sku": "configurable-product-22",
"name": "Configurable Product",
"attribute_set_id": 92,
"price": 20,
"status": 1,
"visibility": 4,
"type_id": "configurable",
"extension_attributes": {
"stock_item": {
"qty": 100,
"is_in_stock": true
},
"configurable_product_options": [
{
"attribute_id": "681", //Attribute ID available in {{Base_url}}/rest/V1/products/attributes/color_dropdown
"label": "color_dropdown",
"position": 0,
"values": [
{
"value_index": 1922 //Color Dropdown ID
}
]
}
],
"configurable_product_links": [
"14602" //Simple Product ID created above
]
}
}
}curl --location '{{Base_url}}/rest/V1/products' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJraWQiOiIxIiwiYWxnIjoiSFMyNTYifQ.eyJ1aWQiOjU1LCJ1dHlwaWQiOjIsImlhdCI6MTczNjc1NDI3OSwiZXhwIjoxNzM2NzU3ODc5fQ.Fh_EDGygLD_8KVVV42qHv5DCVXsx5012T-jSd75Pfj4' \
--header 'Cookie: PHPSESSID=6t4unirh1unu87ef0stp2sv3kv; private_content_version=5ab80b7def0c212f723edead3c971a19' \
--data '{
"product": {
"sku": "configurable-product-22",
"name": "Configurable Product",
"attribute_set_id": 92,
"price": 20,
"status": 1,
"visibility": 4,
"type_id": "configurable",
"extension_attributes": {
"stock_item": {
"qty": 100,
"is_in_stock": true
},
"configurable_product_options": [
{
"attribute_id": "681",
"label": "color_dropdown",
"position": 0,
"values": [
{
"value_index": 1922
}
]
}
],
"configurable_product_links": [
"14602"
]
}
}
}'This cURL request is for creating a configurable product in Magento via the REST API. A configurable product allows customers to select options (like size or color) that are linked to simple products.
Payload (Product Information):
skuUnique identifier for the product (e.g.,
"configurable-product-22").
nameName of the product (e.g.,
"Configurable Product").
attribute_set_idDefines the attribute set for the product (e.g.,
92).
priceBase price of the configurable product (e.g.,
20). This acts as a placeholder since pricing is tied to associated simple products.
statusProduct status:
1for enabled,0for disabled.
visibilityVisibility setting:
4: Visible in catalog and search.
type_idIndicates the product type.
"configurable"specifies this is a configurable product.
extension_attributes:stock_itemDetails about inventory:
qty: Stock quantity (100).is_in_stock: Indicates stock availability (true).
configurable_product_optionsDefines the configurable options for the product:
attribute_id: ID of the attribute used for configuration (e.g.,"681"for color).label: Label for the configurable attribute (e.g.,"color_dropdown").position: Display order of the attribute (e.g.,0).values: Array of possible values for this attribute:value_index: Option value (e.g.,1922).
configurable_product_linksLinks the configurable product to its associated simple products:
14602: Theidof a simple product that belongs to this configurable product.
Responses
{
"id": 14603,
"sku": "configurable-product-22",
"name": "Configurable Product",
"attribute_set_id": 92,
"price": 0,
"status": 1,
"visibility": 4,
"type_id": "configurable",
"created_at": "2025-01-10 11:53:21",
"updated_at": "2025-01-13 07:57:15",
"extension_attributes": {
"website_ids": [
1
],
"stock_item": {
"item_id": 432291,
"product_id": 14603,
"stock_id": 1,
"qty": 0,
"is_in_stock": true,
"is_qty_decimal": false,
"show_default_notification_message": false,
"use_config_min_qty": true,
"min_qty": 0,
"use_config_min_sale_qty": 1,
"min_sale_qty": 1,
"use_config_max_sale_qty": true,
"max_sale_qty": 100,
"use_config_backorders": true,
"backorders": 0,
"use_config_notify_stock_qty": true,
"notify_stock_qty": 1,
"use_config_qty_increments": true,
"qty_increments": 0,
"use_config_enable_qty_inc": true,
"enable_qty_increments": false,
"use_config_manage_stock": true,
"manage_stock": true,
"low_stock_date": null,
"is_decimal_divided": false,
"stock_status_changed_auto": 0
},
"configurable_product_options": [
{
"id": 1128,
"attribute_id": "681",
"label": "color_dropdown",
"position": 0,
"values": [
{
"value_index": "1922",
"label": "New Color Option",
"sku": "simple-product-sku1_color",
"price": "50.00",
"special_price": "0.00",
"status": "1",
"is_in_stock": true,
"qty": 100
}
],
"product_id": 14603
}
],
"configurable_product_links": [
14602
]
},
"options": [],
"media_gallery_entries": [
{
"id": 212576,
"media_type": "external-video",
"label": "Sample Video",
"position": 2,
"disabled": false,
"types": [],
"file": "/0/_/0_4.jpg",
"extension_attributes": {
"video_content": {
"media_type": "external-video",
"video_provider": "youtube",
"video_url": "https://www.youtube.com/watch?v=SEivYngJ4r0",
"video_title": "Lasko Purifier A504IN",
"video_description": "This is a sample video description.",
"video_metadata": ""
}
}
}
],
"custom_attributes": [
{
"attribute_code": "image",
"value": "/0/_/0.jpg"
},
{
"attribute_code": "url_key",
"value": "configurable-product-aaaa"
},
{
"attribute_code": "small_image",
"value": "/0/_/0.jpg"
},
{
"attribute_code": "options_container",
"value": "container2"
},
{
"attribute_code": "thumbnail",
"value": "/0/_/0.jpg"
},
{
"attribute_code": "purchase_price_cap",
"value": "0.000000"
},
{
"attribute_code": "msrp_display_actual_price_type",
"value": "0"
},
{
"attribute_code": "is_sclp",
"value": "0"
},
{
"attribute_code": "required_options",
"value": "0"
},
{
"attribute_code": "has_options",
"value": "0"
},
{
"attribute_code": "image_label",
"value": "Sample Video"
},
{
"attribute_code": "small_image_label",
"value": "Sample Video"
},
{
"attribute_code": "thumbnail_label",
"value": "Sample Video"
},
{
"attribute_code": "popular_product",
"value": "0"
},
{
"attribute_code": "tax_class_id",
"value": "2"
},
{
"attribute_code": "category_ids",
"value": []
},
{
"attribute_code": "sw_featured",
"value": "0"
}
]
}Top-Level Attributes
idUnique identifier for the configurable product (e.g.,
14603).
skuStock Keeping Unit for the configurable product (e.g.,
"configurable-product-22").
nameProduct name (e.g.,
"Configurable Product").
attribute_set_idID of the attribute set associated with this product (e.g.,
92).
priceBase price for the configurable product (e.g.,
0). Actual pricing comes from the associated simple products.
statusProduct status:
1for enabled,0for disabled.
visibilityDefines visibility:
4: Visible in catalog and search.
type_idProduct type:
"configurable".
created_at/updated_atTimestamps for when the product was created and last updated.
Extension Attributes
website_idsList of websites where this product is available (e.g.,
[1]).
stock_itemInventory details for the product:
qty: Stock quantity (e.g.,0).is_in_stock: Indicates if the product is in stock (e.g.,true).Various other attributes control stock behavior (e.g.,
min_qty,backorders, etc.).
configurable_product_optionsDefines the configurable options for this product:
id: Internal ID for this option (e.g.,1128).attribute_id: Attribute used for configuration (e.g.,"681"forcolor_dropdown).label: Display label for the option (e.g.,"color_dropdown").values: Available options:value_index: Option ID (e.g.,1922).label: Label for the option (e.g.,"New Color Option").sku: SKU of the associated simple product (e.g.,"simple-product-sku1_color").price: Price of the simple product (50.00).status: Status of the simple product (1).qty: Stock quantity for the simple product (100).
configurable_product_linksIDs of simple products associated with this configurable product (e.g.,
[14602]).
Options
optionsArray for custom product options (e.g., left empty here).
Media Gallery Entries
media_gallery_entriesProduct media details:
id: Media ID (e.g.,212576).media_type: Type of media (e.g.,"external-video").label: Media label (e.g.,"Sample Video").file: File path or image/video reference (e.g.,"/0/_/0_4.jpg").extension_attributes.video_content: Video details:video_provider: Provider (e.g.,"youtube").video_url: Video URL.video_title: Title of the video.video_description: Description of the video.
Custom Attributes
image,small_image,thumbnailPaths to product images (e.g.,
"/0/_/0.jpg").
url_keySEO-friendly URL for the product (e.g.,
"configurable-product-aaaa").
options_containerPlacement of additional options on the product page (e.g.,
"container2").
purchase_price_capReserved for price limitations (e.g.,
"0.000000").
msrp_display_actual_price_typeDefines how MSRP is displayed (e.g.,
"0").
is_sclp,required_options,has_optionsFlags indicating special behaviors or configurations (e.g.,
"0"means disabled).
image_label,small_image_label,thumbnail_labelLabels for different media types (e.g.,
"Sample Video").
popular_productCustom attribute indicating if this product is popular (e.g.,
"0").
tax_class_idTax class applied to the product (e.g.,
"2").
category_idsArray of category IDs the product belongs to (e.g.,
[]).
sw_featuredIndicates if the product is featured (e.g.,
"0").
{
"message": "The product that was requested doesn't exist. Verify the product and try again."
}{
"message": "The consumer isn't authorized to access %resources."
}Last updated