Manage product categories

Once you have access to the eCommerce platform, define the categories your products belong to. Categories should be the first object type you import into your account.

Create a category

To create a category, see eCommerce > Create/Update a category in the API reference. Below is an example of body parameters used to create or update a category.

cURL Request

1curl --request POST \
2 --url https://api.brevo.com/v3/categories \
3 --header 'accept: application/json' \
4 --header 'content-type: application/json' \
5 --data '
6{
7 "id": "CAT123",
8 "name": "Electronics",
9 "url": "http://mydomain.com/category/electronics"
10 "updateEnabled": false
11}

The cURL request shows the parameters used to create a category. Default values for each parameter are shown below.

Body parameters

AttributeTypeDescriptionValue
idStringUnique Category ID as saved in the shopCAT23
nameStringCategory nameElectronics
urlStringURL to the categoryhttp://mydomain.com/category/electronics
updateEnabledBooleanAllows updating the existing category in the same request. true or false.false

Update a category

Update a category by setting updateEnabled to true in the create request.

1{
2 "updateEnabled": true
3}
AttributeDatatypeDescriptionValue
updateEnabledBooleanAllows updating the existing category in the same request. true or false.true

You can then change the category’s name and URL and run the request to update it.

Response codes

Response codeMessageDescription
201Category CreatedOn success, you receive a 201 response code with the category ID in the response body.
204Category updatedOn a successful update, you receive a 204 response code with no body, indicating the category has been updated.
401Unauthorized response- Your api-key may be incorrect.
- You haven’t activated access to the API. See this article for details.
- The format for name and url may be incorrect.

Retrieving all categories

Retrieve the categories you added by calling the eCommerce > Return all your categories API endpoint. The attributes used to return all your categories are below.

cURL Request

1curl --request GET \
2 --url 'https://api.brevo.com/v3/categories?limit=20&offset=0&sort=desc&ids=CAT123&ids=CAT234' \
3 --header 'accept: application/json'

Parameters to retrieve all categories:

AttributeDatatypeDescriptionValue
limitint64Number of category items per page50
offsetint64Index of the first item in the page0
sortStringSort the results in the ascending/descending order of record creation.desc
idsArray of stringsFilter by category idsCAT123

Retrieving a category’s details

Get a category’s details by passing its ID to the get a category details endpoint.

1curl --request GET \
2 --url https://api.brevo.com/v3/categories/CAT123 \
3 --header 'accept: application/json' \
4 --header 'api-key: '

This endpoint has only one attribute:

AttributeDatatypeDescriptionValue
idStringCategory IDCAT123

Creating categories in a batch

Send your product categories in batches instead of adding each one individually. A cURL request for creating categories in a batch is below.

1curl --request POST \
2 --url https://api.brevo.com/v3/categories/batch \
3 --header 'accept: application/json' \
4 --header 'content-type: application/json' \
5 --data '
6{
7 "updateEnabled": true
8}

Use the cURL request to call the batch endpoint for categories. The boolean attribute updateEnabled enables or disables updates for all categories being imported.

AttributeDatatypeDescriptionValue
categoriesArray of objectsArray of category objectsid, name, url
updateEnabledBooleanAllows updating existing categories in the same requestfalse

categories is an array of objects. Its sub-attributes are:

AttributeDatatypeDescriptionValue
idStringUnique Category ID as saved in the shop.CAT123
nameStringMandatory in case of creation. Name of the Category, as displayed in the shop.Electronics
urlStringURL to the category.http://mydomain.com/category/electronics

JSON Payload

1{"categories":[{
2 "id": "CAT123",
3 "name": "Example Category 1",
4 "url": "http://shop.com/category/example1"
5},
6{
7 "id": "CAT234",
8 "name": "Example Category 2",
9 "url": "http://shop.com/category/example2"
10},
11{
12 "id": "CAT345",
13 "name": "Example Category 3",
14 "url": "http://shop.com/category/example3"
15 }
16],
17"updateEnabled": true
18}
Good practices for importing category batches
  • You can create up to 100 categories per call. The sub-attributes for categories match the attributes in create a category above.
  • Add the correct category URL to the JSON payload.
  • All attributes are of type string.