Create Simple Product
This API is offering to create Simple Product.
POST {{Base_url}}/rest/V1/products
The Magento API endpoint /rest/V1/products is designed to create a new product in the Magento store programmatically. It allows users to define a product's key attributes such as SKU, name, price, type, and visibility. Additionally, it supports adding media assets like images, which are uploaded in Base64-encoded format along with their MIME type (e.g., image/jpeg, image/png). The API also manages stock levels through extension attributes, enabling inventory control by specifying quantity and stock status.
Required Fields:
sku: Stock Keeping Unit - unique identifier for the product.
name: Name of the product.
attribute_set_id: ID of the attribute set (default: 4 for the default attribute set).
price: Price of the product.
status: Status of the product (1 for enabled, 0 for disabled).
visibility: Visibility of the product (1: Not Visible, 2: Catalog, 3: Search, 4: Catalog & Search).
type_id: Product type (e.g., simple, virtual, downloadable, etc.).
weight: Weight of the product (mandatory for simple products).
qty: inventory of the product (mandatory for simple products).
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
{
"product": {
"sku": "your-product-sku",
"name": "Your Product Name",
"attribute_set_id": 4,
"price": 99.99,
"status": 1,
"visibility": 4,
"type_id": "simple",
"weight": 1.0,
"media_gallery_entries": [
{
"media_type": "image",
"label": "Image Label",
"position": 0,
"disabled": 0,
"types": [
"image",
"small_image",
"thumbnail",
"media_gallery"
],
"file": "rbj1.jpeg",
"content": {
"base64_encoded_data": "<base64_encoded_string>",
"type": "image/png",
"name": "rbj1.jpeg"
}
}
],
"extension_attributes": {
"stock_item": {
"qty": 10,
"is_in_stock": true
}
},
"custom_attributes": [
{
"attribute_code": "description",
"value": "<p>html <b>description here</b></p>"
},
{
"attribute_code": "short_description",
"value": "<p>html <b>short description here</b></p>"
},
{
"attribute_code": "meta_title",
"value": "Product Meta Title"
},
{
"attribute_code": "meta_keyword",
"value": "product, keywords, magento"
},
{
"attribute_code": "meta_description",
"value": "Meta description for the product."
},
{
"attribute_code": "Vendor_id",
"value": "Vendor Product ID."
}
]
}
}Product Attributes Overview
1. sku
Description: The unique identifier or stock-keeping unit for the product.
Example:
"your-product-sku"
2. name
Description: The name of the product displayed to users.
Example:
"Your Product Name"
3. attribute_set_id
Description: The ID of the attribute set that defines the attributes for this product.
Example:
4
4. price
Description: The price of the product.
Example:
99.99
5. status
Description: The availability status of the product.
1= Enabled2= Disabled
Example:
1
6. visibility
Description: Determines the visibility of the product in the store.
1= Not visible individually2= Catalog only3= Search only4= Catalog and Search
Example:
4
7. type_id
Description: The product type (e.g., simple, configurable, virtual, etc.).
Example:
"simple"
8. weight
Description: The weight of the product, applicable for shipping calculations.
Example:
1.0
Media Attributes
9. media_gallery_entries
Description: Contains media files (images) associated with the product.
Subfields:
media_type: Type of media (e.g.,"image").label: Descriptive label for the media.position: The display order for the media.disabled: Specifies whether the media is disabled.0= Enabled1= Disabled
types: Specifies where the media will be used (e.g.,"image","small_image","thumbnail").file: The filename for the media.content: Contains the actual media content.base64_encoded_data: Base64-encoded string of the image data.type: MIME type of the image (e.g.,"image/png", "image/jpeg").name: Name of the media file.
Stock Attributes
10. extension_attributes.stock_item
Description: Contains stock-related information.
Subfields:
qty: The quantity of the product available in stock.is_in_stock: Indicates stock status.true= In stockfalse= Out of stock
Custom Attributes
11. description
Description: A detailed description of the product in HTML format.
Example:
"<p>html <b>description here</b></p>"
12. short_description
Description: A brief description of the product in HTML format.
Example:
"<p>html <b>short description here</b></p>"
13. meta_title
Description: Meta title for the product, used for SEO purposes.
Example:
"Product Meta Title"
14. meta_keyword
Description: Meta keywords for the product, used for SEO purposes.
Example:
"product, keywords, magento"
15. meta_description
Description: Meta description for the product, used for SEO purposes.
Example:
"Meta description for the product."
16. Vendor_id
Description: A custom attribute representing the Vendor product ID, if applicable.
Example:
"Vendor Product ID."
Responses
Last updated