Manage your products
Learn how to create and manage your products
After importing your product categories you can easily manage your product inventory through the following steps.
Requirements
To create and manage your eCommerce store products you need to have access to the Brevo eCommerce app. If you have not already activated the eCommerce platform on your account you can go to eCommerce > Add the eCommerce App.
Create a product
To integrate your store with Brevo you will need to create products. You can check out the API endpoint reference for creating products in eCommerce > Create/Update a product.
The cURL request to do so is the following:
curl --request POST \
--url https://api.brevo.com/v3/products \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"categories": [
"CAT123"
],
"metaInfo": {
"description": "A smartphone"
},
"id": "P11",
"name": "Iphone 11",
"url": "http://mydomain.com/product/electronics/product1",
"imageUrl": "http://mydomain.com/product-absolute-url/img.jpeg",
"sku": "P1",
"price": 500,
"parentId": "P3",
"updateEnabled": true
}'
You can use this cURL request to create a product. You can find the parameters used in creating a product below.
Attribute | Datatype | Description | Value |
---|---|---|---|
id | String | Product ID for which you requested the details | P11 |
name | String | Product name | iPhone 11 |
url | String | Url to the product | http://mydomain.com |
imageUrl | String | Url to the cover image of the product | http://mydomain.com |
sku | String | Product identifier from the shop | P22 |
price | Float | Price of the product | 300.80 |
categories | Array of strings | Category ID of the product. Product can belong to multiple categories | CAT123 |
parentId | String | Parent product id of the product | P200 |
metaInfo | Object | Meta data of product like description, vendor, producer and stock etc. | A small smartphone |
updateEnabled | Boolean | Facilitates to update the existing category in the same request. | false/true |
Create products in a batch
Lets say you have multiple products to create, you can use the endpoint eCommerce > Creates the products in a batch. Instead calling the enpoint multiple times, you can instead create them all in one single batch. The cURL request for batch products creation is as follows:
curl --request POST \
--url https://api.brevo.com/v3/products/batch \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data
Batch limits
You can create up to 100 products in a single batch. Below you find sample JSON code to create products in batches.
{
"products": [
{
"categories": [
"CAT123"
],
"metaInfo": {
"Vendor": "Samsung"
},
"id": "P12",
"name": "Samsung S22",
"url": "http://mydomain.com/product/electronics/product1",
"imageUrl": "http://mydomain.com/product-absoulte-url/img.jpeg",
"sku": "P2",
"price": 600,
"parentId": "P01"
},
{
"categories": [
"CAT123"
],
"metaInfo": {
"vendor": "Samsung"
},
"id": "P3",
"name": "Samsung S21",
"url": "http://mydomain.com/product/electronics/product1",
"imageUrl": "http://mydomain.com/product-absoulte-url/img.jpeg",
"sku": "P33",
"price": 300,
"parentId": "P4"
}
],
"updateEnabled": true
}
The parameters are the same as the ones in Create a product
, only the products are in batches. The parameters used in creating products in batches are mentioned below:
Attributes | Datatype | Description | Value |
---|---|---|---|
products | Array of products objects | Contains all the products in array of products objects | All attributes of the product |
id | String | Product id for which you requested the details | P11 |
name | String | Name of the product | iPhone 11 |
url | String | Url to the product | http://mydomain.com/product/electronics/product1 |
imageUrl | String | Url to the cover image of the product | http://mydomain.com/product-absoulte-url/img.jpeg |
sku | String | Product identifier from the shop | P22 |
price | Float | Price of the product | 300.80 |
categories | Array of Strings | Category ID of the product. Product can belong to multiple categories | CAT123 |
parentId | String | Parent product id of the product | P200 |
metaInfo | Object | Meta data of product like description, vendor, producer and stock etc. | Apple |
updateEnabled | Boolean | Facilitates to update the existing category in the same request. | true/false |
Update a product
To update an existing product, we need to change the parameter updateEnabled
to true. It allows two boolean fields, true and false. We cannot update the product if the field is set to false.
"updateEnabled": true
Attribute | Datatype | Description | Value |
---|---|---|---|
updateEnabled | Boolean | Facilitate to update the existing product in the same request. | True |
If you choose to update the product parameters later, you can set this field to true when you are creating the product.
Responses you should expect
Response code | Message | Description |
---|---|---|
201 | Product created | This shows a message with product id which means that product has been created. |
204 | Product updated | This shows no specific message which means that product has been created. |
401 | Bad request | - Your api-key may not be correct- You have not activated the access to the API. See this article for info. - The format for name and url may not be correct |
You can find a list of errors here.
Retrieving all products
You can test the API to get all the products by going to eCommerce > Return all your products. You can find the cURL request below:
curl --request GET \
--url 'https://api.brevo.com/v3/products?limit=50&offset=0&sort=desc' \
--header 'accept: application/json'
The parameters for this endpoint are:
Attribute | Datatype | Description | Value |
---|---|---|---|
limit | Int64 | Number of documents per page. | 50 |
offset | Int64 | Index of first document in page. | 0 |
sort | String | Sort results in ascending/descending order of record creation. | desc |
ids | Array of strings | Fillter by product ids | Add any number of product ids |
How to get a product's details?
You can get a specific product's details by sending a GET request with the product id of that item. You can test this API endpoint at eCommerce > Get a product's details.
curl --request GET \
--url https://api.brevo.com/v3/products/P11 \
--header 'accept: application/json' \
The cURL request above is responsible for sending the request to the endpoint. id is the only parameter for this endpoint, it is a unique identifier for the product.
Attribute | Datatype | Description | Value |
---|---|---|---|
id | String | Product ID | P11 |
Updated about 1 year ago