Business Units are representations of Companies or Divisions. They allow you to model the structure of a business and the access rights of its users.
5
levels, with the top level being a Business Unit of type Company. Divisions can support inheritance, which allows them to inherit Stores, Associates and their roles, and Approval Rules from parent units higher up in the hierarchy.Representations
BusinessUnit
Generic type to model the fields that all types of Business Units have in common.
id ​String​ | Unique identifier of the Business Unit. |
version ​Int​ | Current version of the Business Unit. |
key ​String​ | User-defined unique and immutable identifier of the Business Unit. MinLength:Â2 ​MaxLength: 256 ​Pattern: ^[A-Za-z0-9_-]+$ ​ |
status ​ | Indicates whether the Business Unit can be edited and used in Orders. |
stores ​Array of StoreKeyReference​ | If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores.
If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. |
inheritedStores ​Array of StoreKeyReference​ | Stores that are inherited from a parent Business Unit. The value of this field is eventually consistent and is only present when the storeMode is set to FromParent . |
storeMode ​ | Defines whether the Stores of the Business Unit are set directly on the Business Unit or are inherited from a parent. |
unitType ​ | Type of the Business Unit indicating its position in a hierarchy. |
name ​String​ | Name of the Business Unit. |
contactEmail ​String​ | Email address of the Business Unit. |
addresses ​Array of Address​ | Addresses used by the Business Unit. |
shippingAddressIds ​Array of String​ | Unique identifiers of addresses used as shipping addresses. |
defaultShippingAddressId ​String​ | Unique identifier of the address used as the default shipping address. |
billingAddressIds ​Array of String​ | Unique identifiers of addresses used as billing addresses. |
defaultBillingAddressId ​String​ | Unique identifier of the address used as the default billing address. |
associateMode ​ | Set to Explicit to prevent the Business Unit inheriting Associates from a parent, set to ExplicitAndFromParent to enable inheritance. |
associates ​Array of Associate​ | Associates that are part of the Business Unit in specific roles. MaxItems: 2000 ​ |
inheritedAssociates ​Array of InheritedAssociate​ | Associates that are inherited from a parent Business Unit. The value of this field is eventually consistent and is only present when the associateMode is set to ExplicitAndFromParent . |
parentUnit ​ | Parent unit of the Business Unit. Only present when the unitType is Division . |
topLevelUnit ​ | Top-level unit of the Business Unit. The top-level unit is of unitType Company . |
approvalRuleMode ​ | |
custom ​CustomFields​ | Custom Fields for the Business Unit. |
createdAt ​DateTime​ | Date and time (UTC) the Business Unit was initially created. |
createdBy ​BETACreatedBy​ | IDs and references that created the BusinessUnit. |
lastModifiedAt ​DateTime​ | Date and time (UTC) the Business Unit was last updated. |
lastModifiedBy ​BETA | IDs and references that last modified the BusinessUnit. |
Company
storeMode ​ | The value of this field is always Explicit because a Company cannot have a parent Business Unit that Stores can be inherited from. |
unitType ​ | Company Type of the Business Unit indicating its position in a hierarchy. |
associateMode ​ | The value of this field is always Explicit because a Company cannot have a parent Business Unit that Associates can be inherited from. |
approvalRuleMode ​ | The value of this field is always Default: Explicit because a Company cannot have a parent Business Unit that Approval Rules can be inherited from.Explicit ​ |
Division
storeMode ​ | Defines whether the Stores of the Division are set explicitly or inherited from a parent Business Unit. Default:ÂFromParent ​ |
unitType ​ | Division Type of the Business Unit indicating its position in a hierarchy. |
associateMode ​ | Determines whether the Division can inherit Associates from a parent. Default:ÂExplicitAndFromParent ​ |
parentUnit ​ | Parent unit of the Division. |
approvalRuleMode ​ | Determines whether a Business Unit can inherit Approval Rules from a parent. Default:ÂExplicitAndFromParent ​ |
BusinessUnitDraft
key ​String​ | User-defined unique and immutable identifier for the Business Unit. MinLength:Â2 ​MaxLength: 256 ​Pattern: ^[A-Za-z0-9_-]+$ ​ |
status ​ | Indicates whether the Business Unit can be edited and used in Orders. Default: Active ​ |
stores ​Array of StoreResourceIdentifier​ | Sets the Stores the Business Unit is associated with. Can only be set when
storeMode is Explicit .
Defaults to empty for Companies and not set for Divisions.If the Business Unit has Stores defined, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must belong to one of the Business Unit's Stores.
If the Business Unit has no Stores, then all of its Carts, Orders, Quotes, Quote Requests, or Shopping Lists must not belong to any Store. |
storeMode ​ | |
unitType ​ | Type of the Business Unit indicating its position in a hierarchy. |
name ​String​ | Name of the Business Unit. |
contactEmail ​String​ | Email address of the Business Unit. |
associateMode ​ | |
associates ​Array of AssociateDraft​ | List of members that are part of the Business Unit in specific roles. MaxItems: 2000 ​ |
approvalRuleMode ​ | |
addresses ​Array of BaseAddress​ | Addresses used by the Business Unit. |
shippingAddresses ​Array of Integer​ | Indexes of entries in addresses to set as shipping addresses.
The shippingAddressIds of the Customer will be replaced by these addresses. |
defaultShippingAddress ​Int​ | Index of the entry in addresses to set as the default shipping address. |
billingAddresses ​Array of Integer​ | Indexes of entries in addresses to set as billing addresses.
The billingAddressIds of the Customer will be replaced by these addresses. |
defaultBillingAddress ​Int​ | Index of the entry in addresses to set as the default billing address. |
custom ​ | Custom Fields for the Business Unit. |
CompanyDraft
unitType ​ | Company Type of the Business Unit indicating its position in a hierarchy. |
DivisionDraft
storeMode ​ | If not set, the Division inherits the Stores from a parent unit.
Set this to Default: Explicit if you want to set the Stores explicitly in the stores field instead.FromParent ​ |
unitType ​ | Division Type of the Business Unit indicating its position in a hierarchy. |
associateMode ​ | Determines whether the Division can inherit Associates from a parent. Default:ÂExplicitAndFromParent ​ |
approvalRuleMode ​ | Determines whether the Division can inherit Approval Rules from a parent. Default:ÂExplicitAndFromParent ​ |
parentUnit ​ | The parent unit of this Division. Can be a Company or a Division. |
Associate
associateRoleAssignments ​Array of AssociateRoleAssignment​ | Roles assigned to the Associate within a Business Unit. MaxItems:Â5 ​ |
customer ​ | The Customer that acts as an Associate in the Business Unit. |
AssociateDraft
associateRoleAssignments ​Array of AssociateRoleAssignmentDraft​ | Roles assigned to the Associate within a Business Unit. MinItems:Â1 ​MaxItems: 5 ​ |
customer ​ | The Customer to be part of the Business Unit. |
AssociateRoleAssignment
associateRole ​ | Role the Associate holds within a Business Unit. |
inheritance ​ | Determines whether the AssociateRoleAssignment can be inherited by child Business Units. Default:ÂDisabled ​ |
AssociateRoleAssignmentDraft
associateRole ​ | Role the Associate holds within a Business Unit. |
inheritance ​ | Determines whether the AssociateRoleAssignment can be inherited by child Business Units. Default:ÂDisabled ​ |
AssociateRoleInheritanceMode
Enabled
The assignment can be inherited by child Business Units.
Disabled
The assignment cannot be inherited by child Business Units.
InheritedAssociate
associateRoleAssignments ​Array of InheritedAssociateRoleAssignment​ | Inherited roles of the Associate within a Business Unit. |
customer ​ | The Customer that acts as an Associate in the Business Unit. |
InheritedAssociateRoleAssignment
associateRole ​ | Inherited role the Associate holds within a Business Unit. |
source ​ | Reference to the parent Business Unit where the assignment is defined explicitly. |
BusinessUnitStatus
Active
The Business Unit can be used in Carts, Orders, Quote Requests, and Quotes and can be edited.
Inactive
- The Business Unit cannot be used in Carts, Orders, Quote Requests, and Quotes and can only be edited using the general endpoint. Status doesn't affect inheritance. Even if a parent unit is inactive, its children remain active and can inherit role assignments.
BusinessUnitType
The type of the Business Unit indicating its position in a hierarchy.
Company
- Top-level Business Unit. Must not have a
parentUnit
defined. Division
- Business Unit with a
parentUnit
reference to a Company or another Division.
BusinessUnitAssociateMode
Determines whether a Business Unit can inherit Associates from a parent.
Explicit
All Associates of a Business Unit must be explicitly assigned. The Business Unit cannot inherit Associates from a parent.
ExplicitAndFromParent
Associates of a Business Unit can be assigned explicitly and inherited from a parent.
BusinessUnitApprovalRuleMode
Division
can use ExplicitAndFromParent
.Explicit
Approval Rules of a Business Unit must be explicitly assigned. The Business Unit cannot inherit Approval Rules from a parent.
ExplicitAndFromParent
Approval Rules of a Business Unit are inherited from a parent and can also be explicitly assigned.
BusinessUnitStoreMode
Defines whether the Stores of the Business Unit are set directly on the Business Unit or are inherited from its parent unit.
Explicit
Stores are defined on the Business Unit.
FromParent
Stores are inherited from the closest parent in the hierarchy that has Stores defined.
BusinessUnitPagedQueryResponse
limit ​Int​ | Number of requested results. |
offset ​Int​ | Number of elements skipped. |
count ​Int​ | Actual number of results returned. |
total ​Int​ | 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 BusinessUnit​ | BusinessUnits matching the query. |
BusinessUnitReference
id ​String​ | Unique identifier of the referenced BusinessUnit. |
typeId ​ | business-unit Type of referenced resource. |
obj ​BusinessUnit​ | Contains the representation of the expanded BusinessUnit. Only present in responses to requests with Reference Expansion for BusinessUnit. |
BusinessUnitKeyReference
key ​String​ | Unique and immutable key of the referenced BusinessUnit. |
typeId ​ | business-unit Type of referenced resource. |
BusinessUnitResourceIdentifier
id
or key
is required. If both are set, an InvalidJsonInput error is returned.id ​String​ | Unique identifier of the referenced BusinessUnit. Required if key is absent. |
key ​String​ | Unique key of the referenced BusinessUnit. Required if id is absent. |
typeId ​ | business-unit Type of referenced resource. If given, it must match the expected ReferenceTypeId of the referenced resource. |
BusinessUnitAssociateResponse
customer ​ | The Customer that acts as an Associate in the Business Unit. |
associateRoles ​Array of AssociateRole​ | Roles assigned to Associates in the Business Unit. |
inheritedAssociateRoles ​Array of AssociateRole​ | Roles inherited by Associates from the parent Business Unit. |
permissions ​Array of Permission​ | Permissions the Associate has in the Business Unit. |
{
"customer": {
"typeId": "customer",
"id": "some-customer-id"
},
"associateRoles": [
{
"id": "first-associate-role-id",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "admin",
"buyerAssignable": true,
"name": "Admin",
"permissions": [
"UpdateAssociates"
]
},
{
"id": "second-associate-role-id",
"version": 1,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "approver",
"buyerAssignable": true,
"name": "Approver",
"permissions": [
"UpdateApprovalFlows"
]
}
],
"inheritedAssociateRoles": [
{
"id": "inherited-associate-role-id",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "buyer",
"buyerAssignable": true,
"name": "Buyer",
"permissions": [
"ViewMyQuotes"
]
}
],
"permissions": [
"UpdateAssociates",
"UpdateApprovalFlows",
"ViewMyQuotes"
]
}
Get BusinessUnit
Get BusinessUnit by ID
view_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
id String ​ | id of the BusinessUnit. |
expand | The parameter can be passed multiple times. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/business-units/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"storeMode": "Explicit",
"stores": [],
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit"
}
Get BusinessUnit by Key
view_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
key String ​ | key of the BusinessUnit. |
expand | The parameter can be passed multiple times. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/business-units/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"storeMode": "Explicit",
"stores": [],
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit"
}
Get Associate in BusinessUnit
Get Associate in BusinessUnit by ID
Retrieves roles and permissions of an Associate in a Business Unit.
view_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
businessUnitId String ​ | id of the BusinessUnit. |
associateId String ​ | id of the Customer acting as an Associate in the Business Unit. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/business-units/{businessUnitId}/associates/{associateId} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"customer": {
"typeId": "customer",
"id": "some-customer-id"
},
"associateRoles": [
{
"id": "first-associate-role-id",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "admin",
"buyerAssignable": true,
"name": "Admin",
"permissions": ["UpdateAssociates"]
},
{
"id": "second-associate-role-id",
"version": 1,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "approver",
"buyerAssignable": true,
"name": "Approver",
"permissions": ["UpdateApprovalFlows"]
}
],
"inheritedAssociateRoles": [
{
"id": "inherited-associate-role-id",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "buyer",
"buyerAssignable": true,
"name": "Buyer",
"permissions": ["ViewMyQuotes"]
}
],
"permissions": ["UpdateAssociates", "UpdateApprovalFlows", "ViewMyQuotes"]
}
Get Associate in BusinessUnit by Key
Retrieves roles and permissions of an Associate in a Business Unit.
view_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
key String ​ | key of the BusinessUnit. |
associateId String ​ | id of the Customer acting as an Associate in the Business Unit. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/business-units/key={key}/associates/{associateId} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"customer": {
"typeId": "customer",
"id": "some-customer-id"
},
"associateRoles": [
{
"id": "first-associate-role-id",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "admin",
"buyerAssignable": true,
"name": "Admin",
"permissions": ["UpdateAssociates"]
},
{
"id": "second-associate-role-id",
"version": 1,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "approver",
"buyerAssignable": true,
"name": "Approver",
"permissions": ["UpdateApprovalFlows"]
}
],
"inheritedAssociateRoles": [
{
"id": "inherited-associate-role-id",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "buyer",
"buyerAssignable": true,
"name": "Buyer",
"permissions": ["ViewMyQuotes"]
}
],
"permissions": ["UpdateAssociates", "UpdateApprovalFlows", "ViewMyQuotes"]
}
Get BusinessUnit in Store
Get BusinessUnit in Store by ID
view_business_units:{projectKey}
view_business_units:{projectKey}:{storeKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
storeKey String ​ | key of the Store. |
id String ​ | id of the BusinessUnit. |
expand | The parameter can be passed multiple times. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/business-units/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"storeMode": "Explicit",
"stores": [],
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit"
}
Get BusinessUnit in Store by Key
view_business_units:{projectKey}
view_business_units:{projectKey}:{storeKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
storeKey String ​ | key of the Store. |
key String ​ | key of the BusinessUnit. |
expand | The parameter can be passed multiple times. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/business-units/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"storeMode": "Explicit",
"stores": [],
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit"
}
Get Associate in BusinessUnit in Store
Get Associate in BusinessUnit in Store by ID
Retrieves roles and permissions of an Associate in a Business Unit in a Store.
view_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
storeKey String ​ | key of the Store. |
businessUnitId String ​ | id of the BusinessUnit. |
associateId String ​ | id of the Customer acting as an Associate in the Business Unit. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/business-units/{businessUnitId}/associates/{associateId} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"customer": {
"typeId": "customer",
"id": "some-customer-id"
},
"associateRoles": [
{
"id": "first-associate-role-id",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "admin",
"buyerAssignable": true,
"name": "Admin",
"permissions": ["UpdateAssociates"]
},
{
"id": "second-associate-role-id",
"version": 1,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "approver",
"buyerAssignable": true,
"name": "Approver",
"permissions": ["UpdateApprovalFlows"]
}
],
"inheritedAssociateRoles": [
{
"id": "inherited-associate-role-id",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "buyer",
"buyerAssignable": true,
"name": "Buyer",
"permissions": ["ViewMyQuotes"]
}
],
"permissions": ["UpdateAssociates", "UpdateApprovalFlows", "ViewMyQuotes"]
}
Get Associate in BusinessUnit in Store by Key
Retrieves roles and permissions of an Associate in a Business Unit in a Store.
view_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
storeKey String ​ | key of the Store. |
key String ​ | key of the BusinessUnit. |
associateId String ​ | id of the Customer acting as an Associate in the Business Unit. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/business-units/key={key}/associates/{associateId} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"customer": {
"typeId": "customer",
"id": "some-customer-id"
},
"associateRoles": [
{
"id": "first-associate-role-id",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "admin",
"buyerAssignable": true,
"name": "Admin",
"permissions": ["UpdateAssociates"]
},
{
"id": "second-associate-role-id",
"version": 1,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "approver",
"buyerAssignable": true,
"name": "Approver",
"permissions": ["UpdateApprovalFlows"]
}
],
"inheritedAssociateRoles": [
{
"id": "inherited-associate-role-id",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"key": "buyer",
"buyerAssignable": true,
"name": "Buyer",
"permissions": ["ViewMyQuotes"]
}
],
"permissions": ["UpdateAssociates", "UpdateApprovalFlows", "ViewMyQuotes"]
}
Query BusinessUnits
view_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
where | The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limit Int ​ | Number of results requested. Default: 20 ​Minimum: 0 ​Maximum: 500 ​ |
offset Int ​ | Number of elements skipped. Default: 0 ​Maximum: 10000 ​ |
withTotal Boolean ​ | 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. |
BusinessUnitPagedQueryResponse
asapplication/json
curl --get https://api.{region}.commercetools.com/{projectKey}/business-units -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"limit": 20,
"offset": 0,
"count": 1,
"total": 1,
"results": [
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit",
"storeMode": "Explicit",
"stores": []
}
]
}
Query BusinessUnits in Store
view_business_units:{projectKey}
view_business_units:{projectKey}:{storeKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
storeKey String ​ | key of the Store. |
where | The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limit Int ​ | Number of results requested. Default: 20 ​Minimum: 0 ​Maximum: 500 ​ |
offset Int ​ | Number of elements skipped. Default: 0 ​Maximum: 10000 ​ |
withTotal Boolean ​ | 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. |
BusinessUnitPagedQueryResponse
asapplication/json
curl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/business-units -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"limit": 20,
"offset": 0,
"count": 1,
"total": 1,
"results": [
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit",
"storeMode": "Explicit",
"stores": []
}
]
}
Check if BusinessUnit exists
Check if BusinessUnit exists by ID
id
. Returns a 200 OK
status if the BusinessUnit exists or a 404 Not Found
otherwise.view_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
id String ​ | id of the BusinessUnit. |
curl --head https://api.{region}.commercetools.com/{projectKey}/business-units/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if BusinessUnit exists by Key
key
. Returns a 200 OK
status if the BusinessUnit exists or a 404 Not Found
otherwise.view_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
key String ​ | key of the BusinessUnit. |
curl --head https://api.{region}.commercetools.com/{projectKey}/business-units/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if BusinessUnit exists by Query Predicate
200 OK
status if any BusinessUnits match the query predicate, or a 404 Not Found
otherwise.view_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
where | The parameter can be passed multiple times. |
curl --head https://api.{region}.commercetools.com/{projectKey}/business-units -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if BusinessUnit exists in Store
Check if BusinessUnit exists in Store by ID
id
. Returns a 200 OK
status if the BusinessUnit exists or a 404 Not Found
otherwise.view_business_units:{projectKey}
view_business_units:{projectKey}:{storeKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
storeKey String ​ | key of the Store. |
id String ​ | id of the BusinessUnit. |
curl --head https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/business-units/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if BusinessUnit exists in Store by Key
key
. Returns a 200 OK
status if the BusinessUnit exists or a 404 Not Found
otherwise.view_business_units:{projectKey}
view_business_units:{projectKey}:{storeKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
storeKey String ​ | key of the Store. |
key String ​ | key of the BusinessUnit. |
curl --head https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/business-units/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if BusinessUnit exists in Store by Query Predicate
200 OK
status if any BusinessUnits match the query predicate, or a 404 Not Found
otherwise.view_business_units:{projectKey}
view_business_units:{projectKey}:{storeKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
storeKey String ​ | key of the Store. |
where | The parameter can be passed multiple times. |
curl --head https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/business-units -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Create BusinessUnit
manage_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
expand | The parameter can be passed multiple times. |
application/json
application/json
curl https://api.{region}.commercetools.com/{projectKey}/business-units -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"name" : "commercetools",
"unitType" : "Company",
"key" : "commercetools"
}
DATA
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"storeMode": "Explicit",
"stores": [],
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit"
}
Create BusinessUnit in Store
manage_business_units:{projectKey}
manage_business_units:{projectKey}:{storeKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
storeKey String ​ | key of the Store. |
expand | The parameter can be passed multiple times. |
application/json
application/json
curl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/business-units -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"name" : "commercetools",
"unitType" : "Company",
"key" : "commercetools"
}
DATA
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"storeMode": "Explicit",
"stores": [],
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit"
}
Update BusinessUnit
Update BusinessUnit by ID
manage_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
id String ​ | id of the BusinessUnit. |
expand | The parameter can be passed multiple times. |
application/json
version ​Int​ | Expected version of the BusinessUnit 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 BusinessUnitUpdateAction​ | Update actions to be performed on the BusinessUnit. |
application/json
curl https://api.{region}.commercetools.com/{projectKey}/business-units/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 3,
"actions" : [ {
"action" : "addAddress",
"address" : {
"streetName" : "Any Street",
"streetNumber" : "1337",
"postalCode" : "11111",
"city" : "Any City",
"country" : "US"
}
} ]
}
DATA
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"storeMode": "Explicit",
"stores": [],
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit"
}
Update BusinessUnit by Key
manage_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
key String ​ | key of the BusinessUnit. |
expand | The parameter can be passed multiple times. |
application/json
version ​Int​ | Expected version of the BusinessUnit 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 BusinessUnitUpdateAction​ | Update actions to be performed on the BusinessUnit. |
application/json
curl https://api.{region}.commercetools.com/{projectKey}/business-units/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 3,
"actions" : [ {
"action" : "addAddress",
"address" : {
"streetName" : "Any Street",
"streetNumber" : "1337",
"postalCode" : "11111",
"city" : "Any City",
"country" : "US"
}
} ]
}
DATA
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"storeMode": "Explicit",
"stores": [],
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit"
}
Update BusinessUnit in Store
Update BusinessUnit in Store by ID
manage_business_units:{projectKey}
manage_business_units:{projectKey}:{storeKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
storeKey String ​ | key of the Store. |
id String ​ | id of the BusinessUnit. |
expand | The parameter can be passed multiple times. |
application/json
version ​Int​ | Expected version of the BusinessUnit 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 BusinessUnitUpdateAction​ | Update actions to be performed on the BusinessUnit. |
application/json
curl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/business-units/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 3,
"actions" : [ {
"action" : "addAddress",
"address" : {
"streetName" : "Any Street",
"streetNumber" : "1337",
"postalCode" : "11111",
"city" : "Any City",
"country" : "US"
}
} ]
}
DATA
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"storeMode": "Explicit",
"stores": [],
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit"
}
Update BusinessUnit in Store by Key
manage_business_units:{projectKey}
manage_business_units:{projectKey}:{storeKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
storeKey String ​ | key of the Store. |
key String ​ | key of the BusinessUnit. |
expand | The parameter can be passed multiple times. |
application/json
version ​Int​ | Expected version of the BusinessUnit 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 BusinessUnitUpdateAction​ | Update actions to be performed on the BusinessUnit. |
application/json
curl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/business-units/key={key} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 3,
"actions" : [ {
"action" : "addAddress",
"address" : {
"streetName" : "Any Street",
"streetNumber" : "1337",
"postalCode" : "11111",
"city" : "Any City",
"country" : "US"
}
} ]
}
DATA
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"storeMode": "Explicit",
"stores": [],
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit"
}
Update actions
Add Address
action ​String​ | "addAddress" |
address ​BaseAddress​ | Address to add to the addresses of the Business Unit. |
{
"action": "addAddress",
"address": {
"id": "exampleAddress",
"key": "exampleKey",
"title": "My Address",
"salutation": "Mr.",
"firstName": "Example",
"lastName": "Person",
"streetName": "Example Street",
"streetNumber": "4711",
"additionalStreetInfo": "Backhouse",
"postalCode": "80933",
"city": "Exemplary City",
"region": "Exemplary Region",
"state": "Exemplary State",
"country": "DE",
"company": "My Company Name",
"department": "Sales",
"building": "Hightower 1",
"apartment": "247",
"pOBox": "2471",
"phone": "+49 89 12345678",
"mobile": "+49 171 2345678",
"email": "mail@example.com",
"fax": "+49 89 12345679",
"additionalAddressInfo": "no additional Info",
"externalId": "Information not needed"
}
}
Add Associate
action ​String​ | "addAssociate" |
associate ​ | The Associate to add. |
{
"action": "addAssociate",
"associate": {
"customer": {
"typeId": "customer",
"id": "some-customer-id"
},
"associateRoleAssignments": [
{
"associateRole": {
"typeId": "associate-role",
"key": "admin"
},
"inheritance": "Enabled"
},
{
"associateRole": {
"typeId": "associate-role",
"key": "buyer"
}
}
]
}
}
Add Billing Address Identifier
action ​String​ | "addBillingAddressId" |
addressId ​String​ | ID of the address to add as a billing address. Either addressId or addressKey is required. |
addressKey ​String​ | Key of the address to add as a billing address. Either addressId or addressKey is required. |
{
"action": "addBillingAddressId",
"addressId": "{{addressId}}"
}
Add Shipping Address Identifier
action ​String​ | "addShippingAddressId" |
addressId ​String​ | ID of the address to add as a shipping address. Either addressId or addressKey is required. |
addressKey ​String​ | Key of the address to add as a shipping address. Either addressId or addressKey is required. |
{
"action": "addShippingAddressId",
"addressId": "{{addressId}}"
}
Add Store
storeMode
is Explicit
.action ​String​ | "addStore" |
store ​ | Store to add. |
{
"action": "addStore",
"store": {
"key": "{{store-key}}",
"typeId": "store"
}
}
Change Address
action ​String​ | "changeAddress" |
addressId ​String​ | ID of the address to change. Either addressId or addressKey is required. |
addressKey ​String​ | Key of the address to change. Either addressId or addressKey is required. |
address ​BaseAddress​ | New address to set. |
{
"action": "changeAddress",
"addressId": "{{addressId}}",
"address": {
"id": "exampleAddress",
"key": "exampleKey",
"title": "My Address",
"salutation": "Mr.",
"firstName": "Example",
"lastName": "Person",
"streetName": "Example Street",
"streetNumber": "4711",
"additionalStreetInfo": "Backhouse",
"postalCode": "80933",
"city": "Exemplary City",
"region": "Exemplary Region",
"state": "Exemplary State",
"country": "DE",
"company": "My Company Name",
"department": "Sales",
"building": "Hightower 1",
"apartment": "247",
"pOBox": "2471",
"phone": "+49 89 12345678",
"mobile": "+49 171 2345678",
"email": "email@example.com",
"fax": "+49 89 12345679",
"additionalAddressInfo": "no additional Info",
"externalId": "Information not needed"
}
}
Change Associate
action ​String​ | "changeAssociate" |
associate ​ | New version of an existing Associate. |
{
"action": "changeAssociate",
"associate": {
"customer": {
"typeId": "customer",
"id": "some-customer-id"
},
"associateRoleAssignments": [
{
"associateRole": {
"typeId": "associate-role",
"key": "admin"
},
"inheritance": "Enabled"
},
{
"associateRole": {
"typeId": "associate-role",
"key": "buyer"
}
}
]
}
}
Change Associate Mode
Division
can be changed to ExplicitAndFromParent
.
This update action generates a BusinessUnitAssociateModeChanged Message.action ​String​ | "changeAssociateMode" |
associateMode ​ | The new value for associateMode . |
Change Approval Rule Mode
Division
can be changed to ExplicitAndFromParent
.action ​String​ | "changeApprovalRuleMode" |
approvalRuleMode ​ | The new value for approvalRuleMode . |
{
"action": "changeApprovalRuleMode",
"approvalRuleMode": "Explicit"
}
Change Name
action ​String​ | "changeName" |
name ​String​ | New name to set. |
{
"action": "changeName",
"name": "commercetools"
}
Change Parent Unit
5
levels. Each top-level unit can include up to 4 000
Divisions, including direct and indirect children.action ​String​ | "changeParentUnit" |
parentUnit ​ | New parent unit of the Business Unit.
It must be associated with the same Stores, as the old parent unit.
The Business Unit inheritedAssociates and inheritedStores field values will be eventually consistent. |
{
"action": "changeParentUnit",
"parentUnit": {
"typeId": "business-unit",
"key": "commercetools"
}
}
changeParentUnit
or setUnitType
update action is performed simultaneously, a ConcurrentModification error is returned. The error is also returned if the BusinessUnit topLevelUnit
field is being updated asynchronously in the background, as it is eventually consistent.Set Unit Type BETA
This update action is not available via the Me or as-associate API.
5
levels. Each top-level unit can include up to 4 000
Divisions, including direct and indirect children.action ​String​ | "setUnitType" |
unitType ​ | New type of the Business Unit.
If unitType="Company" , the Business Unit storeMode , associateMode , and approvalRuleMode field values must be Explicit . |
parentUnit ​ | New parent unit for the Business Unit, if unitType="Division" . |
{
"action": "setUnitType",
"unitType": "Division",
"parentUnit": {
"typeId": "business-unit",
"key": "commercetools"
}
}
changeParentUnit
or setUnitType
update action is performed simultaneously, a ConcurrentModification error is returned. The error is also returned if the BusinessUnit topLevelUnit
field is being updated asynchronously in the background, as it is eventually consistent.Change Status
action ​String​ | "changeStatus" |
status ​String​ | New status to set. |
{
"action": "changeStatus",
"status": "Inactive"
}
Remove Address
action ​String​ | "removeAddress" |
addressId ​String​ | ID of the address to be removed. Either addressId or addressKey is required. |
addressKey ​String​ | Key of the address to be removed. Either addressId or addressKey is required. |
{
"action": "removeAddress",
"addressId": "{{addressId}}"
}
Remove Associate
action ​String​ | "removeAssociate" |
customer ​ | Associate to remove. |
{
"action": "removeAssociate",
"customer": {
"typeId": "customer",
"id": "some-customer-id"
}
}
Remove Store
storeMode
is Explicit
.action ​String​ | "removeStore" |
store ​ | Store to remove. |
{
"action": "removeStore",
"store": {
"key": "{{store-key}}",
"typeId": "store"
}
}
Remove Billing Address Identifier
action ​String​ | "removeBillingAddressId" |
addressId ​String​ | ID of the address to be removed from billingAddressIds . Either addressId or addressKey is required. |
addressKey ​String​ | Key of the address to be removed from billingAddressIds . Either addressId or addressKey is required. |
{
"action": "removeBillingAddressId",
"addressId": "{{addressId}}"
}
Remove Shipping Address Identifier
action ​String​ | "removeShippingAddressId" |
addressId ​String​ | ID of the address to be removed from shippingAddressIds . Either addressId or addressKey is required. |
addressKey ​String​ | Key of the address to be removed from shippingAddressIds . Either addressId or addressKey is required. |
{
"action": "removeShippingAddressId",
"addressId": "{{addressId}}"
}
Set Address CustomField
action ​String​ | "setAddressCustomField" |
addressId ​String​ | ID of the address to be extended. |
name ​String​ | Name of the Custom Field. |
value ​ | If value is absent or null , this field will be removed if it exists.
Trying to remove a field that does not exist will fail with an InvalidOperation error.
If value is provided, it is set for the field defined by name . |
{
"action": "setAddressCustomField",
"name": "exampleStringField",
"value": "TextString",
"addressId": "{{address-id}}"
}
Set Associates
action ​String​ | "setAssociates" |
associates ​Array of AssociateDraft​ | The new list of Associates. If empty, existing values will be removed. MaxItems:Â2000 ​ |
{
"action": "setAssociates",
"associates": [
{
"customer": {
"typeId": "customer",
"id": "some-customer-id"
},
"associateRoleAssignments": [
{
"associateRole": {
"typeId": "associate-role",
"key": "admin"
},
"inheritance": "Enabled"
}
]
},
{
"customer": {
"typeId": "customer",
"id": "another-customer-id"
},
"associateRoleAssignments": [
{
"associateRole": {
"typeId": "associate-role",
"key": "buyer"
}
}
]
}
]
}
Set Custom Type in Address
action ​String​ | "setAddressCustomType" |
type ​ | Defines the Type that extends the address with Custom Fields.
If absent, any existing Type and Custom Fields are removed from the address . |
fields ​ | Sets the Custom Fields for the address . |
addressId ​String​ | ID of the address to be extended. |
{
"action": "setAddressCustomType",
"type": {
"id": "{{type-id}}",
"typeId": "type"
},
"fields": {
"exampleStringField": "TextString"
},
"addressId": "{{address-id}}"
}
Set Contact Email
action ​String​ | "setContactEmail" |
contactEmail ​String​ | Email to set.
If contactEmail is absent or null , the existing contact email, if any, will be removed. |
{
"action": "setContactEmail",
"contactEmail": "contact@example.com"
}
Set CustomField
action ​String​ | "setCustomField" |
name ​String​ | Name of the Custom Field to add, update, or remove. |
value ​ | If value is absent or null , this field will be removed if it exists.
Trying to remove a field that does not exist will fail with an InvalidOperation error.
If value is provided, it is set for the field defined by name . |
{
"action": "setCustomField",
"name": "exampleStringField",
"value": "TextString"
}
Set Custom Type
action ​String​ | "setCustomType" |
type ​ | Defines the Type that extends the BusinessUnit with Custom Fields.
If absent, any existing Type and Custom Fields are removed from the BusinessUnit. |
fields ​ | Sets the Custom Fields for the BusinessUnit. |
{
"action": "setCustomType",
"type": {
"id": "{{type-id}}",
"typeId": "type"
},
"fields": {
"exampleStringField": "TextString"
}
}
Set Default Billing Address
action ​String​ | "setDefaultBillingAddress" |
addressId ​String​ | ID of the address to add as a billing address. Either addressId or addressKey is required. |
addressKey ​String​ | Key of the address to add as a billing address. Either addressId or addressKey is required. |
{
"action": "setDefaultBillingAddress",
"addressId": "{{addressId}}"
}
Set Default Shipping Address
action ​String​ | "setDefaultShippingAddress" |
addressId ​String​ | ID of the address to add as a shipping address. Either addressId or addressKey is required. |
addressKey ​String​ | Key of the address to add as a shipping address. Either addressId or addressKey is required. |
{
"action": "setDefaultShippingAddress",
"addressId": "{{addressId}}"
}
Set Stores
storeMode
is Explicit
.
Carts and Orders created after the Set Stores update must use the new Stores of
the Business Unit and, if set, their Product Selections, and Channels.
Orders created before the Set Stores update action remain unchanged.
Setting the Stores on a Business Unit generates a BusinessUnitStoresSet Message.action ​String​ | "setStores" |
stores ​Array of StoreResourceIdentifier​ | Stores to set. Overrides the current list of Stores. |
{
"action": "setStores",
"stores": [
{
"key": "{{store-key}}",
"typeId": "store"
}
]
}
Set Store Mode
Division
can be have a store mode of FromParent
. Changing the storeMode
to FromParent
empties the stores
array on the BusinessUnit.
This update action generates a BusinessUnitStoreModeChanged Message.action ​String​ | "setStoreMode" |
storeMode ​ | Set to Explicit to specify Stores for the Business Unit. Set to FromParent to inherit Stores from a parent. |
stores ​Array of StoreResourceIdentifier​ |
{
"action": "setStoreMode",
"storeMode": "FromParent"
}
Delete BusinessUnit
Delete BusinessUnit by ID
manage_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
id String ​ | id of the BusinessUnit. |
version Int ​ | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/json
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/business-units/{id}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"storeMode": "Explicit",
"stores": [],
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit"
}
Delete BusinessUnit by Key
manage_business_units:{projectKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
key String ​ | key of the BusinessUnit. |
version Int ​ | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/json
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/business-units/key={key}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"storeMode": "Explicit",
"stores": [],
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit"
}
Delete BusinessUnit in Store
Delete BusinessUnit in Store by ID
manage_business_units:{projectKey}
manage_business_units:{projectKey}:{storeKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
storeKey String ​ | key of the Store. |
id String ​ | id of the BusinessUnit. |
version Int ​ | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/json
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/business-units/{id}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"storeMode": "Explicit",
"stores": [],
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit"
}
Delete BusinessUnit in Store by Key
manage_business_units:{projectKey}
manage_business_units:{projectKey}:{storeKey}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
storeKey String ​ | key of the Store. |
key String ​ | key of the BusinessUnit. |
version Int ​ | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/json
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/business-units/key={key}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"id": "2a3baa00-44fa-4ab8-bec7-933c31e18dcc",
"version": 5,
"createdAt": "2022-04-19T15:36:17.510Z",
"lastModifiedAt": "2022-04-20T15:41:55.816Z",
"name": "commercetools",
"unitType": "Company",
"key": "commercetools",
"status": "Active",
"storeMode": "Explicit",
"stores": [],
"topLevelUnit": {
"typeId": "business-unit",
"key": "commercetools"
},
"addresses": [],
"associates": [],
"associateMode": "Explicit",
"inheritedAssociates": [],
"approvalRuleMode": "Explicit"
}
GraphQL query fields
ancestors
and inheritedStores
.Ancestors
ancestors
field returns a list of all the parent Business Units of the queried Business Unit. The list is ordered from the top-level Company to the parent unit of the Business Unit.query {
businessUnit(key: "sub-division") {
ancestors {
key
name
contactEmail
status
}
}
}
Inherited Stores
inheritedStores
field returns a list of the Stores a Business Unit inherits from its parent. For a Company, or a Division with storeMode
set to Explicit
, this field is null.query {
businessUnit(key: "sub-division") {
inheritedStores {
store {
key
supplyChannels {
id
key
roles
}
}
}
}
}