A Customer can be a member of multiple Customer Groups. Special prices can be assigned to specific products based on a Customer Group.
10 000 Customer
Groups can be created per Project. Learn more about this limit.Representations
CustomerGroup
idString | Unique identifier of the CustomerGroup. |
versionInt | Current version of the CustomerGroup. |
keyString | User-defined unique identifier for the CustomerGroup. MinLength:2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
nameString | Unique name of the CustomerGroup. |
custom | Custom Fields for the CustomerGroup. |
createdAt | Date and time (UTC) the CustomerGroup was initially created. |
createdByBETA | IDs and references that created the CustomerGroup. |
lastModifiedAt | Date and time (UTC) the CustomerGroup was last updated. |
lastModifiedByBETA | IDs and references that last modified the CustomerGroup. |
CustomerGroupDraft
keyString | User-defined unique identifier for the CustomerGroup. MinLength:2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
groupNameString | Unique value which must be different from any value used for name in CustomerGroup in the Project.
If not, a DuplicateField error is returned. |
custom | Custom Fields for the CustomerGroup. |
CustomerGroupPagedQueryResponse
limitInt | Number of results requested. Default: 20Minimum: 0Maximum: 500 |
offsetInt | Number of elements skipped. Default: 0Maximum: 10000 |
countInt | Actual number of results returned. |
totalInt | 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. |
resultsArray of CustomerGroup | CustomerGroups matching the query. |
CustomerGroupReference
idString | Unique identifier of the referenced CustomerGroup. |
typeId | customer-groupType of referenced resource. |
obj | Contains the representation of the expanded CustomerGroup. Only present in responses to requests with Reference Expansion for CustomerGroups. |
CustomerGroupKeyReference
keyString | User-defined unique identifier of the referenced CustomerGroup. |
typeId | customer-groupType of referenced resource. |
CustomerGroupResourceIdentifier
id or key is required. If both are set, an InvalidJsonInput error is returned.idString | Unique identifier of the referenced CustomerGroup. Required if key is absent. |
keyString | User-defined unique identifier of the referenced CustomerGroup. Required if id is absent. |
typeId | customer-groupType of referenced resource. If given, it must match the expected ReferenceTypeId of the referenced resource. |
Get CustomerGroup
Get CustomerGroup by ID
view_customers:{projectKey}view_customer_groups:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
idString | id of the CustomerGroup. |
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/customer-groups/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" {
"id": "aef9cf41-94ad-4794-8122-62d308900430",
"version": 2,
"name": "Webshop user",
"createdAt": "2017-01-10T06:51:25.896Z",
"lastModifiedAt": "2017-01-10T06:51:25.946Z"
}Get CustomerGroup by Key
view_customers:{projectKey}view_customer_groups:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
keyString | key of the CustomerGroup. |
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/customer-groups/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" {
"id": "aef9cf41-94ad-4794-8122-62d308900430",
"version": 2,
"name": "Webshop user",
"createdAt": "2017-01-10T06:51:25.896Z",
"lastModifiedAt": "2017-01-10T06:51:25.946Z"
}Query CustomerGroups
view_customers:{projectKey}view_customer_groups:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
where | Queryable field: nameThe parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limitInt | Number of results requested. Default: 20Minimum: 0Maximum: 500 |
offsetInt | Number of elements skipped. Default: 0Maximum: 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. |
CustomerGroupPagedQueryResponse
asapplication/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/customer-groups -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" {
"limit": 20,
"offset": 0,
"count": 1,
"total": 1,
"results": [
{
"id": "aef9cf41-94ad-4794-8122-62d308900430",
"version": 2,
"name": "Webshop user",
"createdAt": "2017-01-10T06:51:25.896Z",
"lastModifiedAt": "2017-01-10T06:51:25.946Z"
}
]
}Check if CustomerGroup exists
Check if CustomerGroup exists by ID
id. Returns a 200 status if the CustomerGroup exists, or a 404 status otherwise.view_customers:{projectKey}view_customer_groups:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
idString | id of the CustomerGroup. |
curl --head https://api.{region}.commercetools.com/{projectKey}/customer-groups/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" Check if CustomerGroup exists by Key
key. Returns a 200 status if the CustomerGroup exists, or a 404 status otherwise.view_customers:{projectKey}view_customer_groups:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
keyString | key of the CustomerGroup. |
curl --head https://api.{region}.commercetools.com/{projectKey}/customer-groups/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" Check if CustomerGroup exists by Query Predicate
200 status if any CustomerGroup match the query predicate, or a 404 status otherwise.view_customers:{projectKey}view_customer_groups:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
where | The parameter can be passed multiple times. |
curl --head https://api.{region}.commercetools.com/{projectKey}/customer-groups -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" Create CustomerGroup
manage_customers:{projectKey}manage_customer_groups:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
expand | The parameter can be passed multiple times. |
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/customer-groups -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"groupName" : "Webshop user"
}
DATA{
"id": "aef9cf41-94ad-4794-8122-62d308900430",
"version": 2,
"name": "Webshop user",
"createdAt": "2017-01-10T06:51:25.896Z",
"lastModifiedAt": "2017-01-10T06:51:25.946Z"
}Update CustomerGroup
Update CustomerGroup by ID
manage_customers:{projectKey}manage_customer_groups:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
idString | id of the CustomerGroup. |
expand | The parameter can be passed multiple times. |
application/jsonversionInt | Expected version of the CustomerGroup on which the changes should be applied.
If the expected version does not match the actual version, a ConcurrentModification error will be returned. |
actionsArray of CustomerGroupUpdateAction | Update actions to be performed on the CustomerGroup. |
application/jsoncurl https://api.{region}.commercetools.com/{projectKey}/customer-groups/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeName",
"name" : "New Name"
} ]
}
DATA{
"id": "aef9cf41-94ad-4794-8122-62d308900430",
"version": 2,
"name": "Webshop user",
"createdAt": "2017-01-10T06:51:25.896Z",
"lastModifiedAt": "2017-01-10T06:51:25.946Z"
}Update CustomerGroup by Key
manage_customers:{projectKey}manage_customer_groups:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
keyString | key of the CustomerGroup. |
expand | The parameter can be passed multiple times. |
application/jsonversionInt | Expected version of the CustomerGroup on which the changes should be applied.
If the expected version does not match the actual version, a ConcurrentModification error will be returned. |
actionsArray of CustomerGroupUpdateAction | Update actions to be performed on the CustomerGroup. |
application/jsoncurl https://api.{region}.commercetools.com/{projectKey}/customer-groups/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeName",
"name" : "New Name"
} ]
}
DATA{
"id": "aef9cf41-94ad-4794-8122-62d308900430",
"version": 2,
"name": "Webshop user",
"createdAt": "2017-01-10T06:51:25.896Z",
"lastModifiedAt": "2017-01-10T06:51:25.946Z"
}Update actions
Change Name
actionString | "changeName" |
nameString | New name of the CustomerGroup. |
{
"action": "changeName",
"name": "New Name"
}Set Key
actionString | "setKey" |
keyString | If MinLength: key is absent or null, the existing key, if any, will be removed.2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
{
"action": "setKey",
"key": "newKey"
}Set Custom Type
actionString | "setCustomType" |
type | Defines the Type that extends the CustomerGroup with Custom Fields.
If absent, any existing Type and Custom Fields are removed from the CustomerGroup. |
fields | Sets the Custom Fields fields for the CustomerGroup. |
{
"action": "setCustomType",
"type": {
"id": "{{type-id}}",
"typeId": "type"
},
"fields": {
"exampleStringField": "TextString"
}
}Set CustomField
actionString | "setCustomField" |
nameString | 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"
}Delete CustomerGroup
Delete CustomerGroup by ID
manage_customers:{projectKey}manage_customer_groups:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
idString | id of the CustomerGroup. |
versionInt | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/customer-groups/{id}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"{
"id": "aef9cf41-94ad-4794-8122-62d308900430",
"version": 2,
"name": "Webshop user",
"createdAt": "2017-01-10T06:51:25.896Z",
"lastModifiedAt": "2017-01-10T06:51:25.946Z"
}Delete CustomerGroup by Key
manage_customers:{projectKey}manage_customer_groups:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString | key of the Project. |
keyString | key of the CustomerGroup. |
versionInt | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/customer-groups/key={key}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"{
"id": "aef9cf41-94ad-4794-8122-62d308900430",
"version": 2,
"name": "Webshop user",
"createdAt": "2017-01-10T06:51:25.896Z",
"lastModifiedAt": "2017-01-10T06:51:25.946Z"
}