Customers
A Customer is a person purchasing Products. Carts, Orders, Quotes, Reviews, and Payments can also be associated to a Customer.
Customers represent data about a specific customer in your Project. In addition to the relationship to other Composable Commerce resources, such as Carts and Orders, the Customer object contains information about their name, email address, any addresses associated with them, and more.
By default, Customers are unique across a Project. However, if your Project is structured with Stores, you can create and manage Customers on a Store level. Store-specific Customers are unique in a specific Store and only have access to resources inside that Store. Use the Customer in Store endpoints to manage Store-specific Customers.
A maximum of 10 000 000 Customers can be created per Project. Learn more about this limit here.
Representations
Representations are JSON objects submitted or received as payload to API requests or responses.
Customer
If stores is not empty, the Customer is specific to those Stores.
idString | Unique identifier of the Customer. |
versionInt | Current version of the Customer. |
keyString | User-defined unique identifier of the Customer. MinLength:2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
customerNumberString | User-defined unique identifier of the Customer. Can be used to refer to a Customer in a human-readable way (in emails, invoices, and other correspondence). |
externalIdString | Optional identifier for use in external systems like customer relationship management (CRM) or enterprise resource planning (ERP). |
emailString | Email address of the Customer that is unique for an entire Project or to a Store the Customer is assigned to. It is the mandatory unique identifier of a Customer. |
passwordString | Present only when |
firstNameString | Given name (first name) of the Customer. |
lastNameString | Family name (last name) of the Customer. |
middleNameString | Middle name of the Customer. |
titleString | Title of the Customer, for example, 'Dr.'. |
dateOfBirthDate | Date of birth of the Customer. |
companyNameString | Company name of the Customer. |
vatIdString | Individual VAT ID of the Customer. |
addressesArray of Address | Addresses used by the Customer. |
defaultShippingAddressIdString | ID of the address in |
shippingAddressIdsArray of String | IDs of addresses in |
defaultBillingAddressIdString | ID of the address in |
billingAddressIdsArray of String | IDs of addresses in |
isEmailVerifiedBoolean | Indicates whether the email address of the Customer is verified. |
customerGroup | CustomerGroup to which the Customer belongs. |
locale | Preferred language of the Customer. |
salutationString | Salutation of the Customer, for example, 'Mr.' or 'Mrs.'. |
storesArray of StoreKeyReference | Stores to which the Customer is assigned to.
|
authenticationMode | Indicates whether the Password |
custom | Custom Fields for the Customer. |
createdAt | Date and time (UTC) the Customer was initially created. |
createdByBETA | IDs and references that created the Customer. |
lastModifiedAt | Date and time (UTC) the Customer was last updated. |
lastModifiedByBETA | IDs and references that last modified the Customer. |
CustomerDraft
keyString | User-defined unique identifier for the Customer.
The This field is optional for backwards compatibility reasons, but we strongly recommend setting it. Keys are mandatory for importing Customers with the Import API. MinLength:2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
customerNumberString | User-defined unique identifier for a Customer. Once set, it cannot be changed. Can be used to refer to a Customer in a human-readable way (in emails, invoices, and other correspondence). |
externalIdString | Optional identifier for use in external systems like customer relationship management (CRM) or enterprise resource planning (ERP). |
emailString | Email address of the Customer that must be unique for an entire Project or to a Store the Customer is assigned to. It is the mandatory unique identifier of a Customer. |
passwordString | Required when |
firstNameString | Given name (first name) of the Customer. |
lastNameString | Family name (last name) of the Customer. |
middleNameString | Middle name of the Customer. |
titleString | Title of the Customer, for example, 'Dr.'. |
anonymousCart | Identifies a Cart that will be assigned to the new Customer. |
anonymousIdString | Identifies Carts and Orders belonging to an anonymous session that will be assigned to the new Customer. |
dateOfBirthDate | Date of birth of the Customer. |
companyNameString | Company name of the Customer. When representing a company as a Customer, Business Units provide extended functionality. |
vatIdString | Individual VAT ID of the Customer. |
addressesArray of BaseAddress | Addresses of the Customer. |
defaultShippingAddressInt | Index of the address in the |
shippingAddressesArray of Integer | Indices of the shipping addresses in the |
defaultBillingAddressInt | Index of the address in the |
billingAddressesArray of Integer | Indices of the billing addresses in the |
isEmailVerifiedBoolean | Set to false |
customerGroup | Sets the CustomerGroup for the Customer. |
locale | Preferred language of the Customer. Must be one of the languages supported by the Project. |
salutationString | Salutation of the Customer, for example, 'Mr.' or 'Mrs.'. |
storesArray of StoreResourceIdentifier | Sets the Stores for the Customer.
|
authenticationMode |
Password |
custom | Custom Fields for the Customer. |
CustomerPagedQueryResponse
PagedQueryResult with results containing an array of Customer.
limitInt | Number of results requested. Default:20Maximum: 500 |
offsetInt | Number of elements skipped. Default:0Maximum: 10 000 |
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 |
resultsArray of Customer | Customers matching the query. |
CustomerReference
idString | Unique identifier of the referenced Customer. |
typeId | "customer"References a Customer. |
obj | Contains the representation of the expanded Customer. Only present in responses to requests with Reference Expansion for Customers. |
CustomerResourceIdentifier
ResourceIdentifier to a Customer. Either id or key is required. If both are set, an InvalidJsonInput error is returned.
CustomerSignin
emailString | Email address of the Customer treated as case-insensitive. |
passwordString | Password of the Customer. |
anonymousCart | Identifies a Cart that will be assigned to the Customer. |
anonymousCartSignInMode | Default: MergeWithExistingCustomerCart |
anonymousIdString | If both |
updateProductDataBoolean |
false |
{"email": "johndoe@example.com","password": "secret123","anonymousCart": {"id": "{{cart-id}}","typeId": "cart"}}
CustomerSignInResult
CustomerToken
idString | Unique identifier of the token. |
customerIdString | The |
valueString | Value of the token. |
expiresAt | Date and time (UTC) the token expires. |
createdAt | Date and time (UTC) the token was initially created. |
lastModifiedAt | When the token is created, |
{"id": "266f3f1c-d86e-4376-94ec-b41d657040ae","createdAt": "2022-09-19T15:55:41.775Z","lastModifiedAt": "2022-09-19T15:55:41.775Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"customerId": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","expiresAt": "2022-09-19T15:58:41.772Z","value": "Is5gdF7Ym-Aick-AkmsEHMMBWpByIfjgyXxKxZem"}
CustomerEmailTokenReference
Reference to a CustomerToken for email verification.
idString | Unique identifier of the referenced CustomerToken. |
typeId | "customer-email-token"References a CustomerToken for email verification. |
CustomerPasswordTokenReference
Reference to a CustomerToken for password reset.
idString | Unique identifier of the referenced CustomerToken. |
typeId | "customer-password-token"References a CustomerToken for password reset. |
AnonymousCartSignInMode
MergeWithExistingCustomerCartIf set, the content of an anonymous Cart is merged during sign-in with the Customer's most recently modified active Cart.
UseAsNewActiveCustomerCartIf set, an anonymous Cart is used as the new active Customer Cart, and no LineItems or CustomLineItems are merged.
AuthenticationMode
PasswordThis is the default value. If set, the
passwordfield is required on CustomerDraft and is present on Customer.ExternalAuthIf set, the
passwordfield is optional on CustomerDraft and is not present on Customer.
If you change a Customer's authenticationMode from Password to ExternalAuth, the Customer's password is deleted.
CustomerChangePassword
idString | Unique identifier of the Customer. |
versionInt | Expected version of the Customer on which the changes should be applied. |
currentPasswordString | Current password of the Customer. If the current password does not match, an InvalidCurrentPassword error is returned. |
newPasswordString | New password to be set. |
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"currentPassword": "secret123","newPassword": "newSecret456"}
CustomerCreatePasswordResetToken
emailString | Email address of the Customer treated as case-insensitive. |
ttlMinutesInt | Validity period of the generated token in minutes. Default:34560 |
{"email": "johndoe@example.com"}
CustomerResetPassword
versionInt | Expected version of the Customer. |
tokenValueString | Value of the token to reset the Customer password. |
newPasswordString | New password to be set. |
{"tokenValue": "VRndRV5oCr-pKH2360DnlhqEOVVUZXSAIUXgT5HL","newPassword": "newsecret123"}
CustomerCreateEmailToken
idString | Unique identifier of the Customer. |
versionInt | Expected version of the Customer. |
ttlMinutesInt | Validity period of the generated token in minutes. |
{"id": "58ae9ffc-7e7b-414c-b060-357749d80c55","ttlMinutes": 4320}
CustomerEmailVerify
versionInt | Expected version of the Customer. |
tokenValueString | Value of the token to verify Customer email. |
{"tokenValue": "hI_6fkuFIyd_wadz1JmpRGh1vMvgFrlsSJia3G6d"}
Get Customer
Get Customer by ID
view_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/customers/{id} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Get Customer by Key
view_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
keyString |
|
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/customers/key={key} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Get Customer in Store
The following endpoints return a Customer from a specific Store and also consider Customers that do not have the stores field present.
Get Customer in Store by ID
If the Customer exists in the Project but the stores field references a different Store, this method returns a ResourceNotFound error.
view_customers:{projectKey}view_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
idString |
|
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/{id} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Get Customer in Store by Key
If the Customer exists in the Project but the stores field references a different Store, this method returns a ResourceNotFound error.
view_customers:{projectKey}view_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
keyString |
|
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/key={key} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Query Customers
To perform searches across a large number of Customers for back-office use cases, consider Customer Search instead.
view_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
where | The 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: 20 |
offsetInt | Number of elements skipped. Default: 0 |
withTotalBoolean | Controls the calculation of the total number of query results. Set to Default: true |
var.<varName>String | Predicate parameter values. The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/customers -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"limit": 1,"offset": 0,"count": 1,"total": 10182,"results": [{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}]}
Query Customers in Store
view_customers:{projectKey}view_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
where | The 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: 20 |
offsetInt | Number of elements skipped. Default: 0 |
withTotalBoolean | Controls the calculation of the total number of query results. Set to 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}/customers -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"limit": 1,"offset": 0,"count": 1,"total": 10182,"results": [{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}]}
Check if Customer exists
Check if Customer exists by ID
Checks if a Customer exists for a given id. Returns a 200 OK status if the Customer exists or a 404 Not Found otherwise.
view_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
curl --head https://api.{region}.commercetools.com/{projectKey}/customers/{id} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if Customer exists by Key
Checks if a Customer exists for a given key. Returns a 200 OK status if the Customer exists or a 404 Not Found otherwise.
view_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
keyString |
|
curl --head https://api.{region}.commercetools.com/{projectKey}/customers/key={key} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if Customer exists by Query Predicate
Checks if a Customer exists for a given Query Predicate. Returns a 200 OK status if any Customers match the Query Predicate, or a 404 Not Found otherwise.
view_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
where | The parameter can be passed multiple times. |
curl --head https://api.{region}.commercetools.com/{projectKey}/customers -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if Customer exists in Store
Check if Customer exists in Store by ID
Checks if a Customer exists for a given id. Returns a 200 OK status if the Customer exists or a 404 Not Found otherwise.
view_customers:{projectKey}view_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
idString |
|
curl --head https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/{id} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if Customer exists in Store by Key
Checks if a Customer exists for a given key. Returns a 200 OK status if the Customer exists or a 404 Not Found otherwise.
view_customers:{projectKey}view_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
keyString |
|
curl --head https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/key={key} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if Customer exists in Store by Query Predicate
Checks if a Customer exists for a given Query Predicate. Returns a 200 OK status if any Customers match the Query Predicate or a ResourceNotFound error otherwise.
view_customers:{projectKey}view_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
where | The parameter can be passed multiple times. |
curl --head https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
Create (sign up) Customer
If the anonymousCart field is set on the CustomerDraft, then the newly created Customer will be assigned to that Cart.
Similarly, if the anonymousId field is set, the Customer will be set on all Carts, Orders, ShoppingLists and Payments with the same anonymousId.
Creating a Customer produces the CustomerCreated Message. Simultaneously creating two Customers with the same email address can return a LockedField error.
manage_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
expand | The parameter can be passed multiple times. |
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/customers -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"email" : "johndoe@example.com","firstName" : "John","lastName" : "Doe","password" : "secret123"}DATA
{"customer": {"addresses": [],"email": "johndoe@example.com","firstName": "John","id": "some_123_id","isEmailVerified": false,"lastName": "Doe","password": "****aGg=","version": 1,"createdAt": "2015-07-06T13:22:33.339Z","lastModifiedAt": "2015-07-06T13:22:33.339Z","authenticationMode": "Password","stores": []}}
Create (sign up) Customer in Store
When using this endpoint, if omitted, the Customer stores field is set to the Store specified in the path parameter.
If the anonymousCart field is set on the CustomerDraft, then the newly created Customer will be assigned to that Cart.
Similarly, if the anonymousId field is set, the Customer will be set on all Carts, Orders, ShoppingLists and Payments with the same anonymousId.
If a Cart with a store field specified, the store field must reference the same Store specified in the {storeKey} path parameter.
Creating a Customer produces the CustomerCreated Message. Simultaneously creating two Customers with the same email address can return a LockedField error.
manage_customers:{projectKey}manage_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
expand | The parameter can be passed multiple times. |
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"email" : "johndoe@example.com","firstName" : "John","lastName" : "Doe","password" : "secret123"}DATA
{"customer": {"addresses": [],"email": "johndoe@example.com","firstName": "John","id": "some_123_id","isEmailVerified": false,"lastName": "Doe","password": "****aGg=","version": 1,"createdAt": "2015-07-06T13:22:33.339Z","lastModifiedAt": "2015-07-06T13:22:33.339Z","authenticationMode": "Password","stores": []}}
Update Customer
Update Customer by ID
Simultaneously updating two Customers with the same email address can return a LockedField error.
manage_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
expand | The parameter can be passed multiple times. |
application/jsonversionInt | Expected version of the Customer 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 CustomerUpdateAction | Update actions to be performed on the Customer. |
application/jsoncurl https://api.{region}.commercetools.com/{projectKey}/customers/{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": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Update Customer by Key
Simultaneously updating two Customers with the same email address can return a LockedField error.
manage_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
keyString |
|
expand | The parameter can be passed multiple times. |
application/jsonversionInt | Expected version of the Customer 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 CustomerUpdateAction | Update actions to be performed on the Customer. |
application/jsoncurl https://api.{region}.commercetools.com/{projectKey}/customers/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": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Update Customer in Store
Update Customer in Store by ID
If the Customer exists in the Project but the stores field references a different Store, this method returns a ResourceNotFound error.
Simultaneously updating two Customers with the same email address can return a LockedField error.
manage_customers:{projectKey}manage_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
idString |
|
expand | The parameter can be passed multiple times. |
application/jsonversionInt | Expected version of the Customer 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 CustomerUpdateAction | Update actions to be performed on the Customer. |
application/jsoncurl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/{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": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Update Customer in Store by Key
If the Customer exists in the Project but the stores field references a different Store, this method returns a ResourceNotFound error.
Simultaneously updating two Customers with the same email address can return a LockedField error.
manage_customers:{projectKey}manage_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
keyString |
|
expand | The parameter can be passed multiple times. |
application/jsonversionInt | Expected version of the Customer 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 CustomerUpdateAction | Update actions to be performed on the Customer. |
application/jsoncurl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/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": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Update actions
Change Email
Changes the email of the Customer and sets the isEmailVerified property to false. This update action generates a CustomerEmailChanged Message.
actionString | "changeEmail" |
emailString | Value to set. |
{"action": "changeEmail","email": "email@example.com"}
Set First Name
Setting the first name of the Customer produces the CustomerFirstNameSet Message.
actionString | "setFirstName" |
firstNameString | Value to set. If empty, any existing value is removed. |
{"action": "setFirstName","firstName": "John"}
Set Last Name
Setting the last name of the Customer produces the CustomerLastNameSet Message.
actionString | "setLastName" |
lastNameString | Value to set. If empty, any existing value is removed. |
{"action": "setLastName","lastName": "Person"}
Set Middle Name
actionString | "setMiddleName" |
middleNameString | Value to set. If empty, any existing value is removed. |
{"action": "setMiddleName","middleName": "middleName"}
Set Title
Setting the title of the Customer produces the CustomerTitleSet Message.
actionString | "setTitle" |
titleString | Value to set. If empty, any existing value is removed. |
{"action": "setTitle","title": "Dr"}
Set Salutation
actionString | "setSalutation" |
salutationString | Value to set. If empty, any existing value is removed. |
{"action": "setSalutation","salutation": "Mr"}
Add Address
Adding an address to the Customer produces the CustomerAddressAdded Message.
actionString | "addAddress" |
address | Value to append to the |
{"action": "addAddress","address": {"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 Address
Changing an address of the Customer produces the CustomerAddressChanged Message.
Either addressId or addressKey is required.
actionString | "changeAddress" |
addressIdString |
|
addressKeyString |
|
address | Value to set. |
{"action": "changeAddress","addressId": "{{addressId}}","address": {"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"}}
Remove Address
Removing an address from the Customer produces the CustomerAddressRemoved Message.
Either addressId or addressKey is required.
Set Default Shipping Address
Sets the default shipping address from addresses.
The action adds the id of the specified address to the shippingAddressIds if not contained already. Either addressId or addressKey is required.
Add Shipping Address ID
Adds an Address from the addresses array to shippingAddressIds. Either addressId or addressKey is required.
Remove Shipping Address ID
Removes a shipping address from shippingAddressesIds.
If the shipping address is the default shipping address, the defaultShippingAddressId is unset. Either addressId or addressKey is required.
Set Default Billing Address
Sets the default billing address from addresses.
The action adds the id of the specified Address to the billingAddressIds if not contained already. Either addressId or addressKey is required.
Add Billing Address ID
Adds an Address from the addresses array to billingAddressIds. Either addressId or addressKey is required.
Remove Billing Address ID
Removes a billing address from billingAddressesIds.
If the billing address is the default billing address, the defaultBillingAddressId is unset. Either addressId or addressKey is required.
Set CustomerGroup
Setting the Customer Group of the Customer produces the CustomerGroupSet Message.
To reflect the new Customer Group, this update action can result in updates to the most recently modified active Cart. When this occurs, the following errors can be returned: MatchingPriceNotFound and MissingTaxRateForCountry.
actionString | "setCustomerGroup" |
customerGroup | Value to set. If empty, any existing value is removed. |
{"action": "setCustomerGroup","customerGroup": {"id": "{{customer-group-id}}","typeId": "customer-group"}}
Set Customer Number
Sets a new ID that can be used to refer to a Customer in a human-reabable way (for use in emails, invoices, etc).
actionString | "setCustomerNumber" |
customerNumberString | Value to set. Once set, it cannot be changed. |
{"action": "setCustomerNumber","customerNumber": "123"}
Set External ID
actionString | "setExternalId" |
externalIdString | Value to set. If empty, any existing value is removed. |
{"action": "setExternalId","externalId": "123"}
Set Company Name
Setting a company name produces the CustomerCompanyNameSet Message.
actionString | "setCompanyName" |
companyNameString | Value to set. If empty, any existing value is removed. |
{"action": "setCompanyName","companyName": "Company Ltd."}
Set Date of Birth
Setting the date of birth of the Customer produces the CustomerDateOfBirthSet Message.
actionString | "setDateOfBirth" |
dateOfBirthDate | Value to set. If empty, any existing value is removed. |
{"action": "setDateOfBirth","dateOfBirth": "2015-10-21"}
Set Vat ID
actionString | "setVatId" |
vatIdString | Value to set. If empty, any existing value is removed. |
{"action": "setVatId","vatId": "vatId"}
Set Custom Type
Adding or updating a Custom Type on a Customer generates the CustomerCustomTypeSet Message, removing one generates the CustomerCustomTypeRemoved Message.
actionString | "setCustomType" |
type | Defines the Type that extends the Customer with Custom Fields. If absent, any existing Type and Custom Fields are removed from the Customer. |
fields | Sets the Custom Fields fields for the Customer. |
{"action": "setCustomType","type": {"id": "{{type-id}}","typeId": "type"},"fields": {"exampleStringField": "TextString"}}
Set CustomField
Adding a Custom Field to a Customer generates the CustomerCustomFieldAdded Message, removing one generates the CustomerCustomFieldRemoved Message, and updating an existing one generates the CustomerCustomFieldChanged Message.
actionString | "setCustomField" |
nameString | Name of the Custom Field. |
value | If |
{"action": "setCustomField","name": "exampleStringField","value": "TextString"}
Set Custom Type in Address
Adding or updating a Custom Type on an Address of a Customer generates the CustomerAddressCustomTypeSet Message, and removing one generates the CustomerAddressCustomTypeRemoved Message.
actionString | "setAddressCustomType" |
addressIdString | User-defined unique identifier of the Address to be updated. |
type | Defines the Type that extends the |
fields | Sets the Custom Fields fields for the |
{"action": "setAddressCustomType","type": {"id": "{{type-id}}","typeId": "type"},"fields": {"exampleStringField": "TextString"},"addressId": "{{address-id}}"}
Set CustomField in Address
Adding a Custom Field to an Address of a Customer generates the CustomerAddressCustomFieldAdded Message, removing one generates the CustomerAddressCustomFieldRemoved Message, and updating an existing one generates the CustomerAddressCustomFieldChanged Message.
actionString | "setAddressCustomField" |
addressIdString | User-defined unique identifier of the Address to be updated. |
nameString | Name of the Custom Field. |
value | If |
{"action": "setAddressCustomField","name": "exampleStringField","value": "TextString","addressId": "{{address-id}}"}
Set Locale
Set Key
actionString | "setKey" |
keyString | If 2MaxLength: 256Pattern: ^[A-Za-z0-9_-]+$ |
{"action": "setKey","key": "newKey"}
Set Stores
Sets the Stores the Customer account is associated with. If no Stores are specified, the Customer becomes a global Customer.
actionString | "setStores" |
storesArray of StoreResourceIdentifier | ResourceIdentifier of the Stores to set. |
{"action": "setStores","stores": [{"key": "{{store-key}}","typeId": "store"}]}
Add Store
Associates the Customer with a Store.
actionString | "addStore" |
store | ResourceIdentifier of the Store to add. |
{"action": "addStore","store": {"key": "{{store-key}}","typeId": "store"}}
Remove Store
Removes the association to a Store from the Customer. If no more Stores are assigned, the Customer becomes a global Customer.
actionString | "removeStore" |
store | ResourceIdentifier of the Store to remove. |
{"action": "removeStore","store": {"key": "{{store-key}}","typeId": "store"}}
Set AuthenticationMode
actionString | "setAuthenticationMode" |
authMode | Value to set.
Changing a Customer's |
passwordString | Required when |
{"action": "setAuthenticationMode","authMode": "ExternalAuth"}
Change password of Customer
Changing the password produces the CustomerPasswordUpdated Message with reset=false.
manage_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/customers/password -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"id" : "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version" : 1,"currentPassword" : "secret123","newPassword" : "newSecret456"}DATA
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Change password of Customer in Store
Changing the password of the Customer produces the CustomerPasswordUpdated Message with reset=false.
manage_customers:{projectKey}manage_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/password -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"id" : "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version" : 1,"currentPassword" : "secret123","newPassword" : "newSecret456"}DATA
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Authenticate (sign in) Customer
Authenticates a global Customer not associated with a Store. For more information, see Global versus Store-specific Customers. If the Customer is registered in a Store, use the Authenticate (sign in) Customer in Store method.
Triggers Cart merge during sign-in.
A Cart returned in the CustomerSignInResult has any invalid Line Items removed and is updated with the latest prices, taxes, and discounts. During these updates, the following errors can be returned: MatchingPriceNotFound and MissingTaxRateForCountry.
If an account with the given credentials is not found, an InvalidCredentials error is returned.
manage_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/login -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"email" : "johndoe@example.com","password" : "secret123","anonymousCart" : {"id" : "{{cart-id}}","typeId" : "cart"}}DATA
{"customer": {"addresses": [],"email": "johndoe@example.com","firstName": "John","id": "some_123_id","isEmailVerified": false,"lastName": "Doe","password": "****aGg=","version": 1,"createdAt": "2015-07-06T13:22:33.339Z","lastModifiedAt": "2015-07-06T13:22:33.339Z","authenticationMode": "Password","stores": []}}
Authenticate (sign in) Customer in Store
Authenticates a Customer associated with a Store. For more information, see Global versus Store-specific Customers.
A Cart returned in the CustomerSignInResult has any invalid Line Items removed and is updated with the latest prices, taxes, and discounts. During these updates, the following errors can be returned: MatchingPriceNotFound and MissingTaxRateForCountry.
Triggers Cart merge during sign-in.
If the Customer exists in the Project but the stores field references a different Store, this method returns an InvalidCredentials error.
manage_customers:{projectKey}manage_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/login -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"email" : "johndoe@example.com","password" : "secret123","anonymousCart" : {"id" : "{{cart-id}}","typeId" : "cart"}}DATA
{"customer": {"addresses": [],"email": "johndoe@example.com","firstName": "John","id": "some_123_id","isEmailVerified": false,"lastName": "Doe","password": "****aGg=","version": 1,"createdAt": "2015-07-06T13:22:33.339Z","lastModifiedAt": "2015-07-06T13:22:33.339Z","authenticationMode": "Password","stores": []}}
Password reset of Customer
Create password reset token for Customer
Use this method to create a password reset token for a global Customer during their password reset process.
Creating a password reset token does not invalidate existing tokens.
manage_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/customers/password-token -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"email" : "johndoe@example.com"}DATA
{"id": "266f3f1c-d86e-4376-94ec-b41d657040ae","createdAt": "2022-09-19T15:55:41.775Z","lastModifiedAt": "2022-09-19T15:55:41.775Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"customerId": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","expiresAt": "2022-09-19T15:58:41.772Z","value": "Is5gdF7Ym-Aick-AkmsEHMMBWpByIfjgyXxKxZem"}
Get Customer by password token
Use this method to retrieve the details of a global Customer by using the password token during their password reset process.
view_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
passwordTokenString |
|
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/customers/password-token={passwordToken} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Reset password of Customer
Use this method to reset a global Customer's password during their password reset process.
After the password is reset, any previously issued access and/or refresh tokens created through the password flow or refresh token flow are invalidated.
Resetting the password of the Customer produces the CustomerPasswordUpdated Message with reset=true.
manage_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/customers/password/reset -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"tokenValue" : "VRndRV5oCr-pKH2360DnlhqEOVVUZXSAIUXgT5HL","newPassword" : "newsecret123"}DATA
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Password reset of Customer in Store
Create password reset token for Customer in Store
Use this method to create a password reset token for a Store-specific Customer during their password reset process.
Creating a password reset token does not invalidate existing tokens.
If the Customer exists in the Project but the stores field references a different Store, this method returns a ResourceNotFound error.
manage_customers:{projectKey}manage_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/password-token -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"email" : "johndoe@example.com"}DATA
{"id": "266f3f1c-d86e-4376-94ec-b41d657040ae","createdAt": "2022-09-19T15:55:41.775Z","lastModifiedAt": "2022-09-19T15:55:41.775Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"customerId": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","expiresAt": "2022-09-19T15:58:41.772Z","value": "Is5gdF7Ym-Aick-AkmsEHMMBWpByIfjgyXxKxZem"}
Get Customer in Store by password token
Use this method to retrieve a Store-specific Customer's details by using the password reset token during their password reset process.
If the Customer exists in the Project but the stores field references a different Store, this method returns a ResourceNotFound error.
view_customers:{projectKey}view_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
passwordTokenString |
|
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/password-token={passwordToken} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Reset password of Customer in Store
Use this method to reset a Store-specific Customer's password during their password reset process.
After the password is reset, any previously issued access and/or refresh tokens created through the password flow or refresh token flow are invalidated.
Resetting the password of the Customer produces the CustomerPasswordUpdated Message with reset=true.
If the Customer exists in the Project but the stores field references a different Store, then this method returns a ResourceNotFound error.
manage_customers:{projectKey}manage_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/password/reset -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"tokenValue" : "VRndRV5oCr-pKH2360DnlhqEOVVUZXSAIUXgT5HL","newPassword" : "newsecret123"}DATA
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Email verification of Customer
Create email token for Customer
Use this method to create an email token for a global Customer during their email verification process.
Creating an email token for the Customer produces the CustomerEmailTokenCreated Message.
manage_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/customers/email-token -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"id" : "58ae9ffc-7e7b-414c-b060-357749d80c55","ttlMinutes" : 4320}DATA
{"id": "266f3f1c-d86e-4376-94ec-b41d657040ae","createdAt": "2022-09-19T15:55:41.775Z","lastModifiedAt": "2022-09-19T15:55:41.775Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"customerId": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","expiresAt": "2022-09-19T15:58:41.772Z","value": "Is5gdF7Ym-Aick-AkmsEHMMBWpByIfjgyXxKxZem"}
Get Customer by email token
Use this method to retrieve a global Customer's details by using the email token during their email verification process.
view_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
emailTokenString |
|
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/customers/email-token={emailToken} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Verify email of Customer
Use this method to verify a global Customer's email during their email verification process.
Verifying the email of the Customer produces the CustomerEmailVerified Message.
manage_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/customers/email/confirm -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"tokenValue" : "hI_6fkuFIyd_wadz1JmpRGh1vMvgFrlsSJia3G6d"}DATA
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Email verification of Customer in Store
Create email token for Customer in Store
Use this method to create an email token for a Store-specific Customer during their email verification process.
If the Customer exists in the Project but the stores field references a different Store, this method returns a ResourceNotFound error.
manage_customers:{projectKey}manage_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/email-token -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"id" : "58ae9ffc-7e7b-414c-b060-357749d80c55","ttlMinutes" : 4320}DATA
{"id": "266f3f1c-d86e-4376-94ec-b41d657040ae","createdAt": "2022-09-19T15:55:41.775Z","lastModifiedAt": "2022-09-19T15:55:41.775Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"customerId": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","expiresAt": "2022-09-19T15:58:41.772Z","value": "Is5gdF7Ym-Aick-AkmsEHMMBWpByIfjgyXxKxZem"}
Get Customer in Store by email token
Use this method to retrieve a Store-specific Customer's details by using the email token during their email verification process.
If the Customer exists in the Project but the stores field references a different Store, this method returns a ResourceNotFound error.
view_customers:{projectKey}view_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
emailTokenString |
|
expand | The parameter can be passed multiple times. |
application/jsoncurl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/email-token={emailToken} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Verify email of Customer in Store
Use this method to verify a Store-specific Customer's email during their email verification process.
Verifying the email of the Customer produces the CustomerEmailVerified Message.
If the Customer exists in the Project but the stores field references a different Store, this method returns a ResourceNotFound error.
manage_customers:{projectKey}manage_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
application/jsonapplication/jsoncurl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/email/confirm -i \--header "Authorization: Bearer ${BEARER_TOKEN}" \--header 'Content-Type: application/json' \--data-binary @- << DATA{"tokenValue" : "hI_6fkuFIyd_wadz1JmpRGh1vMvgFrlsSJia3G6d"}DATA
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Delete Customer
Deleting a Customer will also delete any Carts associated with the Customer, except when the Carts were created using the associate endpoints. For more information, see Interact with B2B resources.
Delete Customer by ID
Deleting a Customer produces the CustomerDeleted Message.
manage_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
idString |
|
versionInt | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
dataErasureBoolean | To erase all related personal data in compliance with GDPR, set to Default: false |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/customers/{id}?version={version} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Delete Customer by Key
Deleting a Customer produces the CustomerDeleted Message.
manage_customers:{projectKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
keyString |
|
versionInt | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
dataErasureBoolean | To erase all related personal data in compliance with GDPR, set to Default: false |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/customers/key={key}?version={version} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Delete Customer in Store
Deleting a Customer will also delete any Carts associated with the Customer, except when the Carts were created using the associate endpoints. For more information, see Interact with B2B resources.
Delete Customer in Store by ID
Deleting a Customer produces the CustomerDeleted Message.
If the Customer exists in the Project but the stores field references a different Store, this method returns a ResourceNotFound error.
manage_customers:{projectKey}manage_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
idString |
|
versionInt | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
dataErasureBoolean | To erase all related personal data in compliance with GDPR, set to Default: false |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/{id}?version={version} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}
Delete Customer in Store by Key
Deleting a Customer produces the CustomerDeleted Message.
If the Customer exists in the Project but the stores field references a different Store, this method returns a ResourceNotFound error.
manage_customers:{projectKey}manage_customers:{projectKey}:{storeKey}regionString | Region in which the Project is hosted. |
projectKeyString |
|
storeKeyString |
|
keyString |
|
versionInt | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
dataErasureBoolean | To erase all related personal data in compliance with GDPR, set to Default: false |
application/jsoncurl -X DELETE https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/customers/key={key}?version={version} -i \--header "Authorization: Bearer ${BEARER_TOKEN}"
{"id": "3cdcdcc8-80c5-41bb-abb5-ac8772c9cc24","version": 1,"createdAt": "2022-09-19T14:34:35.843Z","lastModifiedAt": "2022-09-19T14:34:35.843Z","lastModifiedBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"createdBy": {"clientId": "P1Xf1NG2YsFqH2LC31oveDWT","isPlatformClient": false},"email": "johndoe@example.com","firstName": "John","lastName": "Doe","password": "****aGg=","addresses": [],"shippingAddressIds": [],"billingAddressIds": [],"isEmailVerified": false,"stores": [],"authenticationMode": "Password"}