Categories help organize your Products into various classifications. Customers can navigate a shop by browsing for related Products based on each Category.
Products can belong to multiple Categories, and there can be different Category hierarchies for various purposes and Channels. Categories are embedded in the Product search, enabling you to filter and search for Products by their respective parent and child Categories. You can create Categories and customize existing ones based on your specific content, workflows, and metadata requirements.
Assigning Categories to Stores only controls Category visibility in Stores. It does not change discount or search behavior that is based on a Product's own categories.
Categories include built-in fields for search engine optimization, such as unique and internationalizable URL slugs. Because slugs are an API resource for each Category, they can handle large quantities of Categories. The Merchant Center is also designed to handle these classifications of Categories.
10 000 Categories can be created per Project. This is a soft limit that can be increased per Project after a performance impact review. See Limit increase guidance.Category tree locking
The lock scope depends on the operation:
- Whole Category tree: a Change Parent action locks the entire Category tree in the Project for the duration of the request, because it can change the ancestor path of every Category below it. While it is in progress, any other Change Parent action, any Create Category request with a
parent, and any Store update action anywhere in the Project fails. - Parent Category: a Create Category request with a
parentlocks that parent Category. The request fails if another Create Category request under the same parent, a Store update action on that parent or one of its existing children, or a Change Parent action is in progress. Creating a Category without aparentdoesn't take this lock. Requests targeting different parents don't conflict with each other. - Category and its parent: the Set Stores, Add Store, and Remove Store actions lock the Category itself and its parent Category. Concurrent Store updates to the same Category, to sibling Categories, or to a Category and one of its direct children can conflict.
- Category and its descendants: the Set Stores with Descendants, Add Store with Descendants, and Remove Store with Descendants actions don't change any Store when the API receives the request. The API only records the request and responds with
202 Accepted. A background process then updates the target Category and every descendant Category, which is eventually consistent. While the background process runs, it locks the target Category and its subtree, so Store updates, Change Parent actions, and Create Category requests with aparentfor Categories in that subtree fail and should be retried. These actions are only available on the general endpoint and are rejected on the Store-specific endpoint.
Get Category
Get Category by ID
view_products:{projectKey}view_categories:{projectKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
idString ​ | id of the Category. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/categories/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" {
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "123456"
},
"ancestors": [],
"orderHint": "0.1",
"stores": [],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}Get Category by Key
view_products:{projectKey}view_categories:{projectKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
keyString ​ | key of the Category. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/categories/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" {
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "123456"
},
"ancestors": [],
"orderHint": "0.1",
"stores": [],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}Get Category in Store BETA
Get Category in Store by ID
view_products:{projectKey}view_categories:{projectKey}view_products:{projectKey}:{storeKey}view_categories:{projectKey}:{storeKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
storeKeyString ​ | key of the Store. |
idString ​ | id of the Category. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/categories/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" {
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "123456"
},
"ancestors": [],
"orderHint": "0.1",
"stores": [
{
"typeId": "store",
"key": "main-store"
}
],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}Get Category in Store by Key
view_products:{projectKey}view_categories:{projectKey}view_products:{projectKey}:{storeKey}view_categories:{projectKey}:{storeKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
storeKeyString ​ | key of the Store. |
keyString ​ | key of the Category. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/categories/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" {
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "123456"
},
"ancestors": [],
"orderHint": "0.1",
"stores": [
{
"typeId": "store",
"key": "main-store"
}
],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}Query Categories
view_products:{projectKey}view_categories:{projectKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
whereString ​ | Use to filter query responses. For more information, see Query Predicates. The parameter can be passed multiple times. |
sortString ​ | Use to sort query results. For more information, see Sorting. The parameter can be passed multiple times. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
limitInt32 ​ | Number of results requested. Default: 20​Minimum: 0​Maximum: 500​ |
offsetInt32 ​ | Number of elements skipped. Default: 0​Maximum: 10000​ |
withTotalBoolean ​ | Controls the calculation of the total number of query results. Set to false to improve query performance when the total is not needed.Default: true​ |
var.<varName>String ​ | Predicate parameter values. The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/categories -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" {
"limit": 20,
"offset": 0,
"count": 2,
"total": 2,
"results": [
{
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"ancestors": [
{
"typeId": "category",
"id": "123456"
}
],
"orderHint": "0.1",
"stores": [],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
},
{
"id": "1bae3aa3-1e02-49d2-b719-4c5020f50638",
"version": 1,
"name": {
"en": "Long sleeves"
},
"slug": {
"en": "long-sleeves"
},
"ancestors": [],
"orderHint": "0.2",
"stores": [],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}
]
}Query Categories in Store BETA
view_products:{projectKey}view_categories:{projectKey}view_products:{projectKey}:{storeKey}view_categories:{projectKey}:{storeKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
storeKeyString ​ | key of the Store. |
whereString ​ | Use to filter query responses. For more information, see Query Predicates. The parameter can be passed multiple times. |
sortString ​ | Use to sort query results. For more information, see Sorting. The parameter can be passed multiple times. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
limitInt32 ​ | Number of results requested. Default: 20​Minimum: 0​Maximum: 500​ |
offsetInt32 ​ | Number of elements skipped. Default: 0​Maximum: 10000​ |
withTotalBoolean ​ | Controls the calculation of the total number of query results. Set to false to improve query performance when the total is not needed.Default: true​ |
var.<varName>String ​ | Predicate parameter values. The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/categories -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" {
"limit": 20,
"offset": 0,
"count": 2,
"total": 2,
"results": [
{
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"ancestors": [
{
"typeId": "category",
"id": "123456"
}
],
"orderHint": "0.1",
"stores": [],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
},
{
"id": "1bae3aa3-1e02-49d2-b719-4c5020f50638",
"version": 1,
"name": {
"en": "Long sleeves"
},
"slug": {
"en": "long-sleeves"
},
"ancestors": [],
"orderHint": "0.2",
"stores": [],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}
]
}Check if Category exists
Check if Category exists by ID
id. Returns a 200 status if the Category exists, or a 404 status otherwise.view_products:{projectKey}view_categories:{projectKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
idString ​ | id of the Category. |
curl --head https://api.{region}.commercetools.com/{projectKey}/categories/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" Check if Category exists by Key
key. Returns a 200 status if the Category exists, or a 404 status otherwise.view_products:{projectKey}view_categories:{projectKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
keyString ​ | key of the Category. |
curl --head https://api.{region}.commercetools.com/{projectKey}/categories/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" Check if Category exists by Query Predicate
200 status if any Categories match the query predicate, or a 404 status otherwise.view_products:{projectKey}view_categories:{projectKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
whereString ​ |
curl --head https://api.{region}.commercetools.com/{projectKey}/categories -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" Check if Category exists in Store BETA
Check if Category exists in Store by ID
id in the specified Store. Returns a 200 status if the Category exists in the Store or is global, or a 404 status otherwise.view_products:{projectKey}view_categories:{projectKey}view_products:{projectKey}:{storeKey}view_categories:{projectKey}:{storeKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
storeKeyString ​ | key of the Store. |
idString ​ | id of the Category. |
curl --head https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/categories/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" Check if Category exists in Store by Key
key in the specified Store. Returns a 200 status if the Category exists in the Store or is global, or a 404 status otherwise.view_products:{projectKey}view_categories:{projectKey}view_products:{projectKey}:{storeKey}view_categories:{projectKey}:{storeKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
storeKeyString ​ | key of the Store. |
keyString ​ | key of the Category. |
curl --head https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/categories/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" Check if Category exists in Store by Query Predicate
200 status if any Categories match the query predicate, or a 404 status otherwise.view_products:{projectKey}view_categories:{projectKey}view_products:{projectKey}:{storeKey}view_categories:{projectKey}:{storeKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
storeKeyString ​ | key of the Store. |
whereString ​ | Use to filter query responses. For more information, see Query Predicates. The parameter can be passed multiple times. |
curl --head https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/categories -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" Create Category
parent locks that parent Category. For details, see Category tree locking.manage_products:{projectKey}manage_categories:{projectKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/categories -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"name" : {
"en" : "Hats"
},
"slug" : {
"en" : "hats"
},
"parent" : {
"typeId" : "category",
"id" : "123456"
},
"orderHint" : "0.1"
}
DATA{
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "123456"
},
"ancestors": [],
"orderHint": "0.1",
"stores": [],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}Create Category in Store BETA
parent locks that parent Category. For details, see Category tree locking.manage_products:{projectKey}manage_categories:{projectKey}manage_products:{projectKey}:{storeKey}manage_categories:{projectKey}:{storeKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
storeKeyString ​ | key of the Store. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/categories -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"name" : {
"en" : "Hats"
},
"slug" : {
"en" : "hats"
},
"parent" : {
"typeId" : "category",
"id" : "123456"
},
"orderHint" : "0.1"
}
DATA{
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "123456"
},
"ancestors": [],
"orderHint": "0.1",
"stores": [
{
"typeId": "store",
"key": "main-store"
}
],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}Update Category
Update Category by ID
200 OK, unless the request contains a Set Stores with Descendants, Add Store with Descendants, or Remove Store with Descendants update action. In that case, the API responds with 202 Accepted, and the returned Category contains a warnings field with a StoreSettingOngoing Warning.manage_products:{projectKey}manage_categories:{projectKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
idString ​ | id of the Category. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
application/jsonversion​Int64​ | Expected version of the Category on which the changes should be applied.
If the expected version does not match the actual version, a ConcurrentModification error will be returned. |
actions​Array of CategoryUpdateAction​ | Update actions to be performed on the Category. |
curl https://api.{region}.commercetools.com/{projectKey}/categories/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeName",
"name" : {
"en" : "New Name"
}
} ]
}
DATA{
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "123456"
},
"ancestors": [],
"orderHint": "0.1",
"stores": [],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}{
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 2,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
},
"ancestors": [
{
"typeId": "category",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
],
"orderHint": "0.1",
"stores": [
{
"typeId": "store",
"key": "store-a"
}
],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.002Z",
"warnings": [
{
"code": "StoreSettingOngoing",
"message": "The store setting is still ongoing."
}
]
}Update Category by Key
200 OK, unless the request contains a Set Stores with Descendants, Add Store with Descendants, or Remove Store with Descendants update action. In that case, the API responds with 202 Accepted, and the returned Category contains a warnings field with a StoreSettingOngoing Warning.manage_products:{projectKey}manage_categories:{projectKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
keyString ​ | key of the Category. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
application/jsonversion​Int64​ | Expected version of the Category on which the changes should be applied.
If the expected version does not match the actual version, a ConcurrentModification error will be returned. |
actions​Array of CategoryUpdateAction​ | Update actions to be performed on the Category. |
curl https://api.{region}.commercetools.com/{projectKey}/categories/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeName",
"name" : {
"en" : "New Name"
}
} ]
}
DATA{
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "123456"
},
"ancestors": [],
"orderHint": "0.1",
"stores": [],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}{
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 2,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
},
"ancestors": [
{
"typeId": "category",
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
],
"orderHint": "0.1",
"stores": [
{
"typeId": "store",
"key": "store-a"
}
],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.002Z",
"warnings": [
{
"code": "StoreSettingOngoing",
"message": "The store setting is still ongoing."
}
]
}Update Category in Store BETA
Update Category in Store by ID
manage_products:{projectKey}manage_categories:{projectKey}manage_products:{projectKey}:{storeKey}manage_categories:{projectKey}:{storeKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
storeKeyString ​ | key of the Store. |
idString ​ | id of the Category. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
application/jsonversion​Int64​ | Expected version of the Category on which the changes should be applied.
If the expected version does not match the actual version, a ConcurrentModification error will be returned. |
actions​Array of CategoryUpdateAction​ | Update actions to be performed on the Category. |
application/jsoncurl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/categories/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeName",
"name" : {
"en" : "New Name"
}
} ]
}
DATA{
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "123456"
},
"ancestors": [],
"orderHint": "0.1",
"stores": [
{
"typeId": "store",
"key": "main-store"
}
],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}Update Category in Store by Key
manage_products:{projectKey}manage_categories:{projectKey}manage_products:{projectKey}:{storeKey}manage_categories:{projectKey}:{storeKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
storeKeyString ​ | key of the Store. |
keyString ​ | key of the Category. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
application/jsonversion​Int64​ | Expected version of the Category on which the changes should be applied.
If the expected version does not match the actual version, a ConcurrentModification error will be returned. |
actions​Array of CategoryUpdateAction​ | Update actions to be performed on the Category. |
application/jsoncurl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/categories/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeName",
"name" : {
"en" : "New Name"
}
} ]
}
DATA{
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "123456"
},
"ancestors": [],
"orderHint": "0.1",
"stores": [
{
"typeId": "store",
"key": "main-store"
}
],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}Update actions
Set Key
action​String​ | "setKey" |
key​String​ | Value to set. If omitted, any existing value is removed. MinLength:Â2​MaxLength: 256​Pattern: ^[A-Za-z0-9_-]+$​ |
{
"action": "setKey",
"key": "myNewKey"
}Change Name
action​String​ | "changeName" |
name​ | New value to set. Must not be empty. |
{
"action": "changeName",
"name": {
"de": "neuer Category Name",
"en": "new category name"
}
}Change Slug
action​String​ | "changeSlug" |
slug​ |
{
"action": "changeSlug",
"slug": {
"de": "meine-kategorie",
"en": "my-category"
}
}Set Description
action​String​ | "setDescription" |
description​ | Value to set. If omitted, any existing value is removed. |
{
"action": "setDescription",
"description": {
"de": "This is a category description",
"en": "Dies ist eine Kategorie-Beschreibung"
}
}Change Parent
action​String​ | "changeParent" |
parent​ | New value to set as parent. |
{
"action": "changeParent",
"parent": {
"typeId": "category",
"id": "{{category-id}}"
}
}Set Stores BETA
Every direct child Category must be assigned to at least one Store in that set; otherwise, the action is rejected.
-
When updating a Category via the general endpoint, all Stores can be removed as a global Category is accessible in all Stores.
-
When updating a Category via the Store-specific endpoint, the
storesfield cannot be empty; otherwise, an InvalidOperation error is returned.If you do not have permission for every Store currently assigned to the Category, an Unauthorized error is returned.
action​String​ | "setStores" |
stores​Array of StoreResourceIdentifier​ | Value to set. It replaces the entire set of Stores assigned to the Category.
If the stores field contains a Store that you do not have permission for, an InvalidInput error is returned. |
{
"action": "setStores",
"stores": [
{
"typeId": "store",
"key": "store-a"
},
{
"typeId": "store",
"key": "store-b"
}
]
}Add Store BETA
action​String​ | "addStore" |
store​ | Value to add to the Category's
stores.When called through an in-Store endpoint, the caller must have permission for the referenced Store. |
{
"action": "addStore",
"store": {
"typeId": "store",
"key": "store-a"
}
}Remove Store BETA
Every direct child Category must be assigned to at least one Store in that set; otherwise, the action is rejected.
- When updating a Category via the general endpoint, all Stores can be removed as a global Category is accessible in all Stores.
- When updating a Category via the Store-specific endpoint, you can remove the last Store only if at least one Store remains; otherwise, an InvalidOperation error is returned. If you do not have permission for the referenced Store, an InvalidInput error is returned.
action​String​ | "removeStore" |
store​ | Value to remove from the Category's stores. |
{
"action": "removeStore",
"store": {
"typeId": "store",
"key": "store-a"
}
}Set Stores with Descendants BETA
stores of the Category and propagates the same set of Stores to all of its descendant Categories, replacing the entire set of Stores assigned to each affected Category in the subtree. Set an empty array to make the Category and its descendants global and accessible in all Stores.202 Accepted. The returned Category has the same stores as before and an incremented version, and the response contains a warnings field with a StoreSettingOngoing Warning. A background process then applies the change to the Category and to all of its descendant Categories, so the change is eventually consistent.parent for Categories in the subtree can fail and should be retried. For details, see Category tree locking.stores of the Category, an InvalidOperation error is returned. Other update actions in the same request are applied immediately.stores, so only the relation between the Category and its parent is validated.Requests that change the Stores of the same subtree are processed in the order the background process receives them, which isn't necessarily the order they were sent in. Send the next request for the same subtree only after the previous change has been applied.
action​String​ | "setStoresWithDescendants" |
stores​Array of StoreResourceIdentifier​ | Value to set on the Category and each of its descendant Categories. It replaces the entire set of Stores assigned to each Category in the subtree.
If a Store doesn't exist, a ReferencedResourceNotFound error is returned.
If the Category has a parent Category that is assigned to Stores and
stores contains a Store the parent isn't assigned to, an InvalidInput error is returned.If the Category has a parent Category that is assigned to Stores and stores is empty, an InvalidInput error is returned. |
{
"action": "setStoresWithDescendants",
"stores": [
{
"typeId": "store",
"key": "store-a"
},
{
"typeId": "store",
"key": "store-b"
}
]
}Add Store with Descendants BETA
stores of the Category and to all of its descendant Categories.202 Accepted. The returned Category has the same stores as before and an incremented version, and the response contains a warnings field with a StoreSettingOngoing Warning. A background process then applies the change to the Category and to all of its descendant Categories, so the change is eventually consistent.parent for Categories in the subtree can fail and should be retried. For details, see Category tree locking.stores of the Category, an InvalidOperation error is returned. Other update actions in the same request are applied immediately.store, the relations between Categories within the subtree aren't validated, as all of them receive the same change.Requests that change the Stores of the same subtree are processed in the order the background process receives them, which isn't necessarily the order they were sent in. Send the next request for the same subtree only after the previous change has been applied.
action​String​ | "addStoreWithDescendants" |
store​ | Value to add to the
stores of the Category and each of its descendant Categories.If the Store doesn't exist, a ReferencedResourceNotFound error is returned.
If the Category has a parent Category that is assigned to Stores and the Store isn't one of them, an InvalidInput error is returned.
If the Category isn't assigned to any Store and one of its descendant Categories is assigned to a different Store, an InvalidInput error is returned. |
{
"action": "addStoreWithDescendants",
"store": {
"typeId": "store",
"key": "store-a"
}
}Remove Store with Descendants BETA
stores of the Category and from all of its descendant Categories.The Category itself doesn't need to be assigned to the Store, so that descendant Categories that still have it can be updated.
202 Accepted. The returned Category has the same stores as before and an incremented version, and the response contains a warnings field with a StoreSettingOngoing Warning. A background process then applies the change to the Category and to all of its descendant Categories, so the change is eventually consistent.parent for Categories in the subtree can fail and should be retried. For details, see Category tree locking.stores of the Category, an InvalidOperation error is returned. Other update actions in the same request are applied immediately.store, the relations between Categories within the subtree aren't validated, as all of them receive the same change.Requests that change the Stores of the same subtree are processed in the order the background process receives them, which isn't necessarily the order they were sent in. Send the next request for the same subtree only after the previous change has been applied.
action​String​ | "removeStoreWithDescendants" |
store​ | Value to remove from the
stores of the Category and each of its descendant Categories.If the Store doesn't exist, a ReferencedResourceNotFound error is returned.
If removing the Store leaves the Category without Stores while its parent Category is assigned to Stores, an InvalidInput error is returned.
If the Store is the only Store of a descendant Category that would then be left without any Store while its parent Category is still assigned to Stores, an InvalidInput error is returned. |
{
"action": "removeStoreWithDescendants",
"store": {
"typeId": "store",
"key": "store-a"
}
}Change OrderHint
action​String​ | "changeOrderHint" |
orderHint​String​ | New value to set. Must be a decimal value between 0 and 1. When sorted in ascending order, Categories with a lower orderHint appear before those with a higher value (for example, 0.05 before 0.07). |
{
"action": "changeOrderHint",
"orderHint": "0.1"
}Set External ID
This update action sets a new ID that can be used as an additional identifier for external systems like customer relationship management (CRM) or enterprise resource planning (ERP).
action​String​ | "setExternalId" |
externalId​String​ | Value to set. If omitted, any existing value is removed. |
{
"action": "setExternalId",
"externalId": "externalIdString"
}Set Meta Title
action​String​ | "setMetaTitle" |
metaTitle​ | Value to set. |
{
"action": "setMetaTitle",
"metaTitle": {
"de": "Dies ist mein Meta-Title",
"en": "This is my meta title"
}
}Set Meta Description
action​String​ | "setMetaDescription" |
metaDescription​ | Value to set. |
{
"action": "setMetaDescription",
"metaDescription": {
"de": "Dies ist meine MetaDecription",
"en": "this is my meta description"
}
}Set Meta Keywords
action​String​ | "setMetaKeywords" |
metaKeywords​ | Value to set. |
{
"action": "setMetaKeywords",
"metaKeywords": {
"de": "commercetools, genial",
"en": "commercetools, aweseome"
}
}Set Custom Type
action​String​ | "setCustomType" |
type​ | Defines the Type that extends the Category with Custom Fields.
If absent, any existing Type and Custom Fields are removed from the Category. |
fields​ | Object containing the Custom Fields fields for the Category.
Required if at least one Custom Field is defined as required in the fieldDefinitions of the referenced Type. |
{
"action": "setCustomType",
"type": {
"id": "{{type-id}}",
"typeId": "type"
},
"fields": {
"exampleStringField": "TextString"
}
}Set CustomField
action​String​ | "setCustomField" |
name​String​ | Name of the Custom Field. |
value​ | If value is absent or null, this field will be removed if it exists.
Removing a field that does not exist returns an InvalidOperation error.
If value is provided, it is set for the field defined by name. |
{
"action": "setCustomField",
"name": "exampleStringField",
"value": "TextString"
}Add Asset
action​String​ | "addAsset" |
asset​AssetDraft​ | Value to append. |
position​Int32​ | Position in the array at which the Asset should be put. When specified, the value must be between 0 and the total number of Assets minus 1. |
{
"action": "addAsset",
"asset": {
"sources": [
{
"uri": "https://www.commercetools.de/ct-logo.svg",
"key": "vector"
}
],
"name": {
"de": "commercetools Logo",
"en": "commercetools logo"
}
}
}Remove Asset
action​String​ | "removeAsset" |
assetId​String​ | Value to remove. Either assetId or assetKey is required. |
assetKey​String​ | Value to remove. Either assetId or assetKey is required. |
{
"action": "removeAsset",
"assetId": "{{assetId}}"
}Set Asset Key
key of an Asset.action​String​ | "setAssetKey" |
assetId​String​ | Value to set. |
assetKey​String​ | Value to set. If omitted, any existing value is removed. |
{
"action": "setAssetKey",
"assetId": "{{assetId}}"
}Change Asset Order
assets array. The new order is defined by listing the ids of the Assets.action​String​ | "changeAssetOrder" |
assetOrder​Array of String​ | New value to set. Must contain all Asset ids. |
{
"action": "changeAssetOrder",
"assetOrder": [
"{{assetId1}}",
"{{assetId2}}"
]
}Change Asset Name
action​String​ | "changeAssetName" |
assetId​String​ | New value to set. Either assetId or assetKey is required. |
assetKey​String​ | New value to set. Either assetId or assetKey is required. |
name​ | New value to set. Must not be empty. |
{
"action": "changeAssetName",
"assetId": "{{assetId}}",
"name": {
"de": "Mein Asset",
"en": "My asset"
}
}Set Asset Description
action​String​ | "setAssetDescription" |
assetId​String​ | New value to set. Either assetId or assetKey is required. |
assetKey​String​ | New value to set. Either assetId or assetKey is required. |
description​ | Value to set. If omitted, any existing value is removed. |
{
"action": "setAssetDescription",
"assetId": "{{assetId}}",
"description": {
"de": "Dies ist eine Asset-Beschreibung",
"en": "This is an asset description"
}
}Set Asset Sources
action​String​ | "setAssetSources" |
assetId​String​ | New value to set. Either assetId or assetKey is required. |
assetKey​String​ | New value to set. Either assetId or assetKey is required. |
sources​Array of AssetSource​ | Must not be empty. At least one entry is required. |
{
"action": "setAssetSources",
"assetId": "{{assetId}}",
"sources": [
{
"uri": "https://www.commercetools.de/ct-logo.svg",
"key": "vector"
}
]
}Set Asset Custom Type
action​String​ | "setAssetCustomType" |
assetId​String​ | New value to set. Either assetId or assetKey is required. |
assetKey​String​ | New value to set. Either assetId or assetKey is required. |
type​ | Defines the Type that extends the Asset with Custom Fields.
If absent, any existing Type and Custom Fields are removed from the Asset. |
fields​ | Object containing the Custom Fields fields for the Asset.
Required if at least one Custom Field is defined as required in the fieldDefinitions of the referenced Type. |
{
"action": "setAssetCustomType",
"assetId": "{{assetId}}",
"type": {
"id": "{{type-id}}",
"typeId": "type"
},
"fields": {
"exampleStringField": "TextString"
}
}Set Asset CustomField
action​String​ | "setAssetCustomField" |
assetId​String​ | New value to set. Either assetId or assetKey is required. |
assetKey​String​ | New value to set. Either assetId or assetKey is required. |
name​String​ | Name of the Custom Field. |
value​ | If value is absent or null, this field will be removed if it exists.
Removing a field that does not exist returns an InvalidOperation error.
If value is provided, it is set for the field defined by name. |
{
"action": "setAssetCustomField",
"assetId": "{{assetId}}",
"name": "exampleStringField",
"value": "TextString"
}Delete Category
Deleting a root Category deletes the whole Category tree.
Delete Category by ID
manage_products:{projectKey}manage_categories:{projectKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
idString ​ | id of the Category. |
versionInt64 ​ | Last seen version of the resource. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/categories/{id}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"{
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "123456"
},
"ancestors": [],
"orderHint": "0.1",
"stores": [],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}Delete Category by Key
manage_products:{projectKey}manage_categories:{projectKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
keyString ​ | key of the Category. |
versionInt64 ​ | Last seen version of the resource. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/categories/key={key}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"{
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "123456"
},
"ancestors": [],
"orderHint": "0.1",
"stores": [],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}Delete Category in Store BETA
Deleting a root Category deletes the whole Category tree.
Delete Category in Store by ID
manage_products:{projectKey}manage_categories:{projectKey}manage_products:{projectKey}:{storeKey}manage_categories:{projectKey}:{storeKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
storeKeyString ​ | key of the Store. |
idString ​ | id of the Category. |
versionInt64 ​ | Last seen version of the resource. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/categories/{id}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"{
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "123456"
},
"ancestors": [],
"orderHint": "0.1",
"stores": [
{
"typeId": "store",
"key": "main-store"
}
],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}Delete Category in Store by Key
manage_products:{projectKey}manage_categories:{projectKey}manage_products:{projectKey}:{storeKey}manage_categories:{projectKey}:{storeKey}regionString ​ | Region in which the Project is hosted. |
projectKeyString ​ | key of the Project. |
storeKeyString ​ | key of the Store. |
keyString ​ | key of the Category. |
versionInt64 ​ | Last seen version of the resource. |
expandString ​ | Use to expand resources in a single request. For more information, see Reference Expansion. The parameter can be passed multiple times. |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/categories/key={key}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"{
"id": "c2f93298-c967-44af-8c2a-d2220bf39eb2",
"version": 1,
"name": {
"en": "Hats"
},
"slug": {
"en": "hats"
},
"parent": {
"typeId": "category",
"id": "123456"
},
"ancestors": [],
"orderHint": "0.1",
"stores": [
{
"typeId": "store",
"key": "main-store"
}
],
"createdAt": "1970-01-01T00:00:00.001Z",
"lastModifiedAt": "1970-01-01T00:00:00.001Z"
}Representations
Category
id​String​ | Unique identifier of the Category. |
version​Int64​ | Current version of the Category. |
key​String​ | User-defined unique identifier of the Category. MinLength:Â2​MaxLength: 256​Pattern: ^[A-Za-z0-9_-]+$​ |
externalId​String​ | Additional identifier for external systems like customer relationship management (CRM) or enterprise resource planning (ERP). |
name​ | Name of the Category. |
slug​ | User-defined identifier used as a deep-link URL to the related Category per Locale.
A Category can have the same slug for different Locales, but they are unique across the Project.
Valid slugs match the pattern ^[A-Za-z0-9_-]{2,256}+$.
For good performance, indexes are provided for the first 15 languages set in a Project. |
description​ | Description of the Category. |
ancestors​Array of CategoryReference​ | Contains the parent path towards the root Category. |
parent​ | Parent Category of this Category. |
orderHint​String​ | A decimal value between 0 and 1 used to order Categories within the same level of the category tree. When sorted in ascending order, Categories with a lower orderHint appear before those with a higher value (for example, 0.05 before 0.07). |
metaTitle​ | Name of the Category used by external search engines for improved search engine performance. |
metaDescription​ | Description of the Category used by external search engines for improved search engine performance. |
metaKeywords​ | Keywords related to the Category for improved search engine performance. |
assets​Array of Asset​ | Media related to the Category. |
stores​BETAArray of StoreKeyReference​ | Stores to which the Category is assigned and that you have permission to access.
If
stores is empty, the Category is global and available in every Store.If the Category is created via the Store-specific endpoint, the Store specified in the request path is automatically added to the field value. |
custom​CustomFields​ | Custom Fields of the Category. |
createdAt​DateTime​ | Date and time (UTC) the Category was initially created. |
createdBy​BETACreatedBy​ | IDs and references that created the Category. |
lastModifiedAt​DateTime​ | Date and time (UTC) the Category was last updated. |
lastModifiedBy​BETA | IDs and references that last modified the Category. |
warnings​Array of WarningObject​ | Warnings about processing of a request.
Appears in response to requests with response status code 202 Accepted. |
CategoryDraft
key​String​ | User-defined unique identifier for the Category. This field is optional for backwards compatibility reasons, but we strongly recommend setting it. Keys are mandatory for importing Categories with the Import API and the Merchant Center. MinLength: 2​MaxLength: 256​Pattern: ^[A-Za-z0-9_-]+$​ |
externalId​String​ | Additional identifier for external systems like customer relationship management (CRM) or enterprise resource planning (ERP). |
name​ | Name of the Category. |
slug​ | |
description​ | Description of the Category. |
parent​ | Parent Category of the Category.
The parent can be set by its id or key. |
orderHint​String​ | A decimal value between 0 and 1 used to order Categories within the same level of the category tree. When sorted in ascending order, Categories with a lower orderHint appear before those with a higher value (for example, 0.05 before 0.07).
If not set, a random value is assigned. |
metaTitle​ | Name of the Category used by external search engines for improved search engine performance. |
metaDescription​ | Description of the Category used by external search engines for improved search engine performance. |
metaKeywords​ | Keywords related to the Category for improved search engine performance. |
assets​Array of AssetDraft​ | Media related to the Category. |
stores​BETAArray of StoreResourceIdentifier​ | Stores to assign the Category to.
|
custom​ | Custom Fields for the Category. |
CategoryPagedQueryResponse
limit​Int64​ | Number of results requested. Default: 20​Minimum: 0​Maximum: 500​ |
offset​Int64​ | Number of elements skipped. Default: 0​Maximum: 10000​ |
count​Int64​ | Actual number of results returned. |
total​Int64​ | Total number of results matching the query.
This number is an estimation that is not strongly consistent.
This field is returned by default.
For improved performance, calculating this field can be deactivated by using the query parameter withTotal=false.
When the results are filtered with a Query Predicate, total is subject to a limit. |
results​Array of Category​ | Category matching the query. |
CategoryReference
id​String​ | Unique identifier of the referenced Category. |
typeId​ | category |
obj​Category​ | Contains the representation of the expanded Category. Only present in responses to requests with Reference Expansion for Categories. |
CategoryKeyReference
key​String​ | User-defined unique identifier of the referenced Category. |
typeId​ | category |
CategoryResourceIdentifier
id or key is required. If both are set, an InvalidJsonInput error is returned.