Manage your product categories

Learn how to create, update and manage your product categories

After accessing the eCommerce platform you can start defining the categories that your products will be associated to. Note that this should ideally be the first object type you import into your account.

Create a category

To create a category, go to the eCommerce > Create/Update a category in the API reference. Below you find an example of body parameters which can be used to create or update a category.

cURL Request

curl --request POST \
     --url https://api.sendinblue.com/v3/categories \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
     "id": "CAT123",
     "name": "Electronics",
     "url": "http://mydomain.com/category/electronics"
     "updateEnabled": false
}

The cURL request shows us what parameters will be used to create a category. Below, you can see some default values mentioned for each parameter.

Body parameters

AttributeTypeDescriptionValue
idStringUnique Category ID as saved in the shopCAT23
nameStringCategory nameElectronics
urlStringURL to the categoryhttp://mydomain.com/category/electronics
updateEnabledBooleanFacilitates to update the existing category in the same request. It can be true or false.false

Update a category

You can update a category by changing the boolean value to true in the updateEnabled attribute when you are creating the category.

{
     "updateEnabled": true
}
AttributeDatatypeDescriptionValue
updateEnabledBooleanFacilitates to update the existing category in the same request. It can be true or false.true

You can then change the name and url of the category and then run it to update the respective category.

Response codes

Response codeMessageDescription
201Category CreatedIf the request succeeds, you will receive the response code 201 for creating a category with the id of the category as message in the response.
204Category updatedFor updating a category successfully, you will receive a response code of 204 with no message in response which shows that category has been updated.
401Unauthorized response- 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

Retrieving all categories

You can retrieve the categories you added by calling the eCommerce > Return all your categories API endpoint in the API reference. Below you can see the attributes used for returning all your categories.

cURL Request

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

The parameters to retrieve all categories are as following:

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 details

You can get a category's details by entering the id for the category in the get a category details endpoint.

curl --request GET \
     --url https://api.sendinblue.com/v3/categories/CAT123 \
     --header 'accept: application/json' \
     --header 'api-key: '

There is only one attribute for this endpoint mentioned below:

AttributeDatatypeDescriptionValue
idStringCategory IDCAT123

Creating categories in a batch

You can use this to send your product categories in batches so you don't have to add every category individually. Below you can find a cURL request for creating categories in a batch.

curl --request POST \
     --url https://api.sendinblue.com/v3/categories/batch \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
     "updateEnabled": true
}

We can use the cURL request to call the batch endpoint for categories. Note the boolean attribute updateEnabled is included to enable or disable updates for all the categories being imported.

AttributeDatatypeDescriptionValue
categoriesArray of objectsArray of category objectsid, name, url
updateEnabledBooleanFacilitate to update the existing categories in the same requestfalse

Categories is an array of objects. It has further sub-attributes.

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

{"categories":[{
    "id": "CAT123",
    "name": "Example Category 1",
    "url": "http://shop.com/category/example1"
},
{
    "id": "CAT234",
    "name": "Example Category 2",
    "url": "http://shop.com/category/example2"
},
{
    "id": "CAT345",
    "name": "Example Category 3",
    "url": "http://shop.com/category/example3"
    }
],
"updateEnabled": true
}

πŸ“˜

Good practices for importing category batches

  • You can create up to 100 categories per call . The sub-attributes for categories are same as the attributes in create a category above.
  • Be sure to add the proper category url to the JSON payload.
  • All the attributes have the data type as string.

What’s Next