My Customer Profile

The My Customer Profile API creates and provides access to a Customer profile scoped to a specific Customer.

The API requires an access token from the password flow or anonymous session flow.

The My Customer Profile API can also be used to create (sign up) a Customer from an anonymous session, or merge (sign in) an anonymous session to an existing account.

The API intentionally provides access to a limited subset of fields on Customer to provide extra security in scenarios when the client application must communicate directly with the commercetools Composable Commerce API on behalf of a customer, such as commerce in a mobile application. If you need to modify a field available on the Customer resource, do it from a trusted, server-side application.

Customer Group, customer number, external ID, and ExternalAuth authentication mode cannot be set with this API.

Representations

Representations are JSON objects submitted or received as payload to API requests or responses. Responses are similar to the responses returned on the Customers API, but requests may differ.

MyCustomerDraft

email
String

Email address of the Customer that is unique for an entire Project or Store the Customer is assigned to. It is the mandatory unique identifier of a Customer.

password
String

Password of the Customer.

firstName
String

Given name (first name) of the Customer.

lastName
String

Family name (last name) of the Customer.

middleName
String

Middle name of the Customer.

title
String

Title of the Customer, for example, 'Dr.'.

salutation
String

Salutation of the Customer, for example, 'Mr.' or 'Mrs.'.

dateOfBirth
Date

Date of birth of the Customer.

companyName
String

Company name of the Customer.

vatId
String

Individual VAT ID of the Customer.

addresses
Array of BaseAddress

Addresses of the Customer.

defaultShippingAddress
Int

Index of the address in the addresses array to use as the default shipping address. The defaultShippingAddressId of the Customer will be set to the id of that address.

defaultBillingAddress
Int

Index of the address in the addresses array to use as the default billing address. The defaultBillingAddressId of the Customer will be set to the id of that address.

locale

Preferred language of the Customer. Must be one of the languages supported by the Project.

stores

Sets the Stores for the Customer.

custom

Custom Fields for the Customer.

MyCustomerSignin

email
String

Email address of the Customer treated as case-insensitive.

password
String

Password of the Customer.

activeCartSignInMode
  • If MergeWithExistingCustomerCart, LineItems of the anonymous Cart are merged with the recently modified active Customer Cart.
  • If UseAsNewActiveCustomerCart, the anonymous Cart is used as the new active Customer Cart, and no LineItems are merged.
Default: MergeWithExistingCustomerCart
updateProductData
Boolean
  • If true, the LineItem Product data (name, variant, and productType) of the returned Cart is updated.
  • If false, only the prices, discounts, and tax rates are updated.
Default: false
Example: json
{
"email": "johndoe@example.com",
"password": "secret123",
"anonymousCart": {
"id": "{{cart-id}}",
"typeId": "cart"
}
}

MyCustomerChangePassword

version
Int

Expected version of the Customer on which the changes should be applied.

currentPassword
String

Current password of the Customer.

If the current password does not match, an InvalidCurrentPassword error is returned.

newPassword
String

New password to be set.

Example: json
{
"version": 1,
"currentPassword": "secret123",
"newPassword": "newSecret456"
}

MyCustomerResetPassword

tokenValue
String

Value of the token to reset the Customer password.

newPassword
String

New password to be set.

Example: json
{
"tokenValue": "VRndRV5oCr-pKH2360DnlhqEOVVUZXSAIUXgT5HL",
"newPassword": "newsecret123"
}

MyCustomerEmailVerify

tokenValue
String

Value of the token to verify Customer email.

Example: json
{
"tokenValue": "hI_6fkuFIyd_wadz1JmpRGh1vMvgFrlsSJia3G6d"
}

Get Customer

GET
https://api.{region}.commercetools.com/{projectKey}/me

Returns a Customer for a given Query Predicate. Returns a 200 OK status if successful.

A ResourceNotFound error is returned in the following scenarios:

  • If no Customer exists for the given Query Predicate.
  • If a Customer exists for the given Query Predicate, but does not have an id value that matches the customer:{id} scope.
OAuth 2.0 Scopes:
manage_my_profile:{projectKey}customer_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

Query parameters:
where
The parameter can be passed multiple times.
/^var[.][a-zA-Z0-9]+$/
Any string parameter matching this regular expression

Predicate parameter values.

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
offset
Int

Number of elements skipped.

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
Response:
200Customerasapplication/json
Request Example:cURL
curl --get https://api.{region}.commercetools.com/{projectKey}/me -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
200 Response Example: Customerjson
{
"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 BETA

GET
https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me

Returns a Customer for a given Query Predicate in a Store. Returns a 200 OK status if successful.

A ResourceNotFound error is returned in the following scenarios:

  • If no Customer exists in the Store for the given Query Predicate.
  • If a Customer exists in the Store for the given Query Predicate, but does not have an id value that matches the customer:{id} scope.
  • If a Customer exists for the given Query Predicate but is associated with a different Store than what is specified in the manage_my_profile:{projectKey}:{storeKey} scope.
OAuth 2.0 Scopes:
manage_my_profile:{projectKey}manage_my_profile:{projectKey}:{storeKey}customer_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

storeKey
String

key of the Store.

Query parameters:
where
The parameter can be passed multiple times.
/^var[.][a-zA-Z0-9]+$/
Any string parameter matching this regular expression

Predicate parameter values.

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
offset
Int

Number of elements skipped.

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
Response:
200Customerasapplication/json
Request Example:cURL
curl --get https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
200 Response Example: Customerjson
{
"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"
}

Create (sign up) Customer

When used with an access token obtained by an anonymous session flow, all Orders and Carts belonging to the anonymousId are assigned to the newly created Customer.

POST
https://api.{region}.commercetools.com/{projectKey}/me/signup

If used with an optional access token for an anonymous session, all Orders and Carts that belong to the anonymousId are assigned to the newly created Customer.

Creating a Customer produces the CustomerCreated Message.

OAuth 2.0 Scopes:
manage_my_profile:{projectKey}anonymous_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

Request Body:MyCustomerDraftasapplication/json
Response:
201CustomerSignInResultasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/me/signup -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
201 Response Example: CustomerSignInResultjson
{
"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 BETA

When used with an access token obtained by an anonymous session flow, all Orders and Carts belonging to the anonymousId are assigned to the newly created Customer.

POST
https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/signup

If used with an optional access token for an anonymous session, all Orders and Carts that belong to the anonymousId are assigned to the newly created Customer.

If omitted in the request body, the Customer stores field is set to the Store specified in the path parameter.

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.

Creating a Customer produces the CustomerCreated Message.

OAuth 2.0 Scopes:
manage_my_profile:{projectKey}manage_my_profile:{projectKey}:{storeKey}anonymous_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

storeKey
String

key of the Store.

Request Body:MyCustomerDraftasapplication/json
Response:
201CustomerSignInResultasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/signup -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
201 Response Example: CustomerSignInResultjson
{
"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

When used with an access token obtained by an anonymous session flow, all Orders and Carts belonging to the anonymousId are assigned to the newly created Customer.

POST
https://api.{region}.commercetools.com/{projectKey}/me/login

Retrieves the authenticated customer (that matches the given email/password pair).

If used with an optional access token for an anonymous session, all Orders and Carts that belong to the anonymousId are assigned to the newly logged-in Customer.

  • If the Customer does not have a Cart yet, the most recently modified anonymous cart becomes the Customer's Cart.
  • If the Customer already has a Cart, the most recently modified anonymous cart is handled in accordance with AnonymousCartSignInMode.

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.

OAuth 2.0 Scopes:
manage_my_profile:{projectKey}anonymous_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

Request Body:MyCustomerSigninasapplication/json
Response:
200CustomerSignInResultasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/me/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
200 Response Example: CustomerSignInResultjson
{
"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 BETA

When used with an access token obtained by an anonymous session flow, all Orders and Carts belonging to the anonymousId are assigned to the newly created Customer.

POST
https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/login

Retrieves the authenticated Customer (that matches the given email/password pair) if they are part of a specific Store.

If used with an optional access token for an anonymous session, all Orders and Carts that belong to the anonymousId are assigned to the newly logged-in Customer.

  • If the Customer does not have a Cart, the most recently modified anonymous cart becomes the Customer's Cart.
  • If the Customer already has a Cart, the most recently modified anonymous cart is handled according to AnonymousCartSignInMode.

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.

OAuth 2.0 Scopes:
manage_my_profile:{projectKey}manage_my_profile:{projectKey}:{storeKey}anonymous_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

storeKey
String

key of the Store.

Request Body:MyCustomerSigninasapplication/json
Response:
200CustomerSignInResultasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/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
200 Response Example: CustomerSignInResultjson
{
"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

POST
https://api.{region}.commercetools.com/{projectKey}/me

Updates the Customer specified in the customer:{id} scope. Returns a 200 OK status if successful.

OAuth 2.0 Scopes:
manage_my_profile:{projectKey}customer_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

Request Body:
application/json
version
Int

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.

actions

Update actions to be performed on the Customer.

Response:
200Customerasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/me -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
200 Response Example: Customerjson
{
"addresses": [
{
"city": "Any City",
"country": "US",
"id": "some_456_id",
"postalCode": "11111",
"streetName": "Any Street",
"streetNumber": "1337"
}
],
"email": "janedoe@example.com",
"firstName": "Jane",
"id": "some_123_id",
"isEmailVerified": false,
"lastName": "Doe",
"password": "****aGg=",
"version": 4,
"createdAt": "2015-05-06T12:10:12.421Z",
"lastModifiedAt": "2015-07-06T13:22:33.339Z",
"authenticationMode": "Password",
"stores": []
}

Update Customer in Store BETA

POST
https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me

Updates the Customer in a Store. Returns a 200 OK status if successful.

A ResourceNotFound error is returned in the following scenarios:

  • If no Customer exists with the id specified in the customer:{id} scope.
  • If the Customer exists but is associated with a different Store than what is specified in the manage_my_profile:{projectKey}:{storeKey} scope.
OAuth 2.0 Scopes:
manage_my_profile:{projectKey}manage_my_profile:{projectKey}:{storeKey}customer_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

storeKey
String

key of the Store.

Request Body:
application/json
version
Int

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.

actions

Update actions to be performed on the Customer.

Response:
200Customerasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me -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
200 Response Example: Customerjson
{
"addresses": [
{
"city": "Any City",
"country": "US",
"id": "some_456_id",
"postalCode": "11111",
"streetName": "Any Street",
"streetNumber": "1337"
}
],
"email": "janedoe@example.com",
"firstName": "Jane",
"id": "some_123_id",
"isEmailVerified": false,
"lastName": "Doe",
"password": "****aGg=",
"version": 4,
"createdAt": "2015-05-06T12:10:12.421Z",
"lastModifiedAt": "2015-07-06T13:22:33.339Z",
"authenticationMode": "Password",
"stores": []
}

Update actions

Change Email

Changing the email of the Customer produces the CustomerEmailChanged Message.

action
String
"changeEmail"
email
String

New value to set.

Example: json
{
"action": "changeEmail",
"email": "email@example.com"
}

Set First Name

Setting the first name of the Customer produces the CustomerFirstNameSet Message.

action
String
"setFirstName"
firstName
String

Value to set. If empty, any existing value is removed.

Example: json
{
"action": "setFirstName",
"firstName": "John"
}

Set Last Name

Setting the last name of the Customer produces the CustomerLastNameSet Message.

action
String
"setLastName"
lastName
String

Value to set. If empty, any existing value is removed.

Example: json
{
"action": "setLastName",
"lastName": "Person"
}

Set Middle Name

action
String
"setMiddleName"
middleName
String

Value to set. If empty, any existing value is removed.

Example: json
{
"action": "setMiddleName",
"middleName": "middleName"
}

Set Title

Setting the title of the Customer produces the CustomerTitleSetMessage.

action
String
"setTitle"
title
String

Value to set. If empty, any existing value is removed.

Example: json
{
"action": "setTitle",
"title": "Dr"
}

Set Salutation

action
String
"setSalutation"
salutation
String

Value to set. If empty, any existing value is removed.

Example: json
{
"action": "setSalutation",
"salutation": "Mr"
}

Add Address

Adding an address to the Customer produces the CustomerAddressAdded Message.

action
String
"addAddress"
address

Value to append to the addresses array.

Example: json
{
"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.

action
String
"changeAddress"
addressId
String

id of the Address to change.

addressKey
String

key of the Address to change.

address

Value to set.

Example: json
{
"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 of the Customer produces the CustomerAddressRemoved Message.

Either addressId or addressKey is required.

action
String
"removeAddress"
addressId
String

id of the Address to remove.

addressKey
String

key of the Address to remove.

Example: json
{
"action": "removeAddress",
"addressId": "{{addressId}}"
}

Set Default Shipping Address

Sets the default shipping address from addresses. If the address is not currently a shipping address, it is added to shippingAddressIds. Either addressId or addressKey is required.

action
String
"setDefaultShippingAddress"
addressId
String

id of the Address to become the default shipping address.

addressKey
String

key of the Address to become the default shipping address.

Example: json
{
"action": "setDefaultShippingAddress",
"addressId": "{{addressId}}"
}

Add Shipping Address ID

Adds an address from the addresses array to shippingAddressIds. Either addressId or addressKey is required.

action
String
"addShippingAddressId"
addressId
String

id of the Address to become a shipping address.

addressKey
String

key of the Address to become a shipping address.

Example: json
{
"action": "addShippingAddressId",
"addressId": "{{addressId}}"
}

Remove Shipping Address ID

Removes an existing shipping address from shippingAddressesIds. If the shipping address is the default shipping address, the defaultShippingAddressId is unset. Either addressId or addressKey is required.

action
String
"removeShippingAddressId"
addressId
String

id of the Address to remove from shippingAddressesIds.

addressKey
String

key of the Address to remove from shippingAddressesIds.

Example: json
{
"action": "removeShippingAddressId",
"addressId": "{{addressId}}"
}

Set Default Billing Address

Sets the default billing address from addresses. If the address is not currently a billing address, it is added to billingAddressIds. Either addressId or addressKey is required.

action
String
"setDefaultBillingAddress"
addressId
String

id of the Address to become the default billing address.

addressKey
String

key of the Address to become the default billing address.

Example: json
{
"action": "setDefaultBillingAddress",
"addressId": "{{addressId}}"
}

Add Billing Address ID

Adds an address from the addresses array to billingAddressIds. Either addressId or addressKey is required.

action
String
"addBillingAddressId"
addressId
String

id of the Address to become a billing address.

addressKey
String

key of the Address to become a billing address.

Example: json
{
"action": "addBillingAddressId",
"addressId": "{{addressId}}"
}

Remove Billing Address ID

Removes an existing billing address from billingAddressesIds. If the billing address is the default billing address, the defaultBillingAddressId is unset. Either addressId or addressKey is required.

action
String
"removeBillingAddressId"
addressId
String

id of the Address to remove from billingAddressesIds.

addressKey
String

key of the Address to remove from billingAddressesIds.

Example: json
{
"action": "removeBillingAddressId",
"addressId": "{{addressId}}"
}

Set Company Name

Setting the companyName field on the Customer produces the CustomerCompanyNameSet Message.

action
String
"setCompanyName"
companyName
String

Value to set. If empty, any existing value is removed.

Example: json
{
"action": "setCompanyName",
"companyName": "Company Ltd."
}

Set Date of Birth

Setting the date of birth of the Customer produces the CustomerDateOfBirthSet Message.

action
String
"setDateOfBirth"
dateOfBirth
Date

Value to set. If empty, any existing value is removed.

Example: json
{
"action": "setDateOfBirth",
"dateOfBirth": "2015-10-21"
}

Set Vat ID

action
String
"setVatId"
vatId
String

Value to set. If empty, any existing value is removed.

Example: json
{
"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.

action
String
"setCustomType"

Defines the Type that extends the MyCustomer with Custom Fields. If absent, any existing Type and Custom Fields are removed from the MyCustomer.

fields

Sets the Custom Fields fields for the MyCustomer.

Example: json
{
"action": "setCustomType",
"type": {
"id": "{{type-id}}",
"typeId": "type"
},
"fields": {
"exampleStringTypeField": "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.

action
String
"setCustomField"
name
String

Name of the Custom Field.

value

If value is absent or null, this field will be removed if it exists. If value is provided, it is set for the field defined by name. Trying to remove a field that does not exist will fail with an InvalidOperation error.

Example: json
{
"action": "setCustomField",
"name": "ExampleStringTypeField",
"value": "TextString"
}

Set Locale

action
String
"setLocale"
locale

Value to set. Must be one of the languages supported by the Project.

Example: json
{
"action": "setLocale",
"locale": "de-DE"
}

Change password of Customer

POST
https://api.{region}.commercetools.com/{projectKey}/me/password

Changing the password of the Customer produces the CustomerPasswordUpdated Message with reset=false.

If the current password does not match, an InvalidCurrentPassword error is returned.

OAuth 2.0 Scopes:
manage_my_profile:{projectKey}customer_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

Request Body:MyCustomerChangePasswordasapplication/json
Response:
200Customerasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/me/password -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"currentPassword" : "secret123",
"newPassword" : "newSecret456"
}
DATA
200 Response Example: Customerjson
{
"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 BETA

POST
https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/password

Changing the password of the Customer produces the CustomerPasswordUpdated Message with reset=false. Returns a 200 OK status if successful.

A ResourceNotFound error is returned in the following scenarios:

  • If no Customer exists with the id specified in the customer:{id} scope.
  • If the Customer exists but is associated with a different Store than what is specified in the manage_my_profile:{projectKey}:{storeKey} scope.
OAuth 2.0 Scopes:
manage_my_profile:{projectKey}manage_my_profile:{projectKey}:{storeKey}customer_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

storeKey
String

key of the Store.

Request Body:MyCustomerChangePasswordasapplication/json
Response:
200Customerasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/password -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"currentPassword" : "secret123",
"newPassword" : "newSecret456"
}
DATA
200 Response Example: Customerjson
{
"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

POST
https://api.{region}.commercetools.com/{projectKey}/me/password/reset

This is the last step in the password reset process of a Customer.

Resetting a password of the Customer produces the CustomerPasswordUpdated Message with reset=true.

OAuth 2.0 Scopes:
manage_my_profile:{projectKey}customer_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

Request Body:MyCustomerResetPasswordasapplication/json
Response:
200Customerasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/me/password/reset -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"tokenValue" : "VRndRV5oCr-pKH2360DnlhqEOVVUZXSAIUXgT5HL",
"newPassword" : "newsecret123"
}
DATA
200 Response Example: Customerjson
{
"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 BETA

POST
https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/password/reset

This is the last step in the password reset process of the authenticated Customer.

Resetting a password produces the Customer CustomerPasswordUpdated Message with reset=true.

A ResourceNotFound error is returned in the following scenarios:

  • If no Customer exists with the id specified in the customer:{id} scope.
  • If the Customer exists but is associated with a different Store than what is specified in the manage_my_profile:{projectKey}:{storeKey} scope.
OAuth 2.0 Scopes:
manage_my_profile:{projectKey}manage_my_profile:{projectKey}:{storeKey}customer_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

storeKey
String

key of the Store.

Request Body:MyCustomerResetPasswordasapplication/json
Response:
200Customerasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/password/reset -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"tokenValue" : "VRndRV5oCr-pKH2360DnlhqEOVVUZXSAIUXgT5HL",
"newPassword" : "newsecret123"
}
DATA
200 Response Example: Customerjson
{
"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

POST
https://api.{region}.commercetools.com/{projectKey}/me/email/confirm

This is the last step in the email verification process of a Customer.

OAuth 2.0 Scopes:
manage_my_profile:{projectKey}customer_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

Request Body:MyCustomerEmailVerifyasapplication/json
Response:
200Customerasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/me/email/confirm -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"tokenValue" : "hI_6fkuFIyd_wadz1JmpRGh1vMvgFrlsSJia3G6d"
}
DATA
200 Response Example: Customerjson
{
"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 BETA

POST
https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/email/confirm

This is the last step in the email verification process of a Customer. Returns a 200 OK status if successful.

A ResourceNotFound error is returned in the following scenarios:

  • If no Customer exists with the id specified in the customer:{id} scope.
  • If the Customer exists but is associated with a different Store than what is specified in the manage_my_profile:{projectKey}:{storeKey} scope.
OAuth 2.0 Scopes:
manage_my_profile:{projectKey}manage_my_profile:{projectKey}:{storeKey}customer_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

storeKey
String

key of the Store.

Request Body:MyCustomerEmailVerifyasapplication/json
Response:
200Customerasapplication/json
Request Example:cURL
curl https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me/email/confirm -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}' \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"tokenValue" : "hI_6fkuFIyd_wadz1JmpRGh1vMvgFrlsSJia3G6d"
}
DATA
200 Response Example: Customerjson
{
"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

DELETE
https://api.{region}.commercetools.com/{projectKey}/me

Deletes the Customer specified in the customer:{id} scope. Returns a 200 OK status if successful.

OAuth 2.0 Scopes:
manage_my_profile:{projectKey}customer_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

Query parameters:
version
Int

Last seen version of the resource.

Response:
200Customerasapplication/json
Request Example:cURL
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/me?version={version} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
200 Response Example: Customerjson
{
"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 BETA

DELETE
https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me

Deletes the Customer in a Store. Returns a 200 OK status if successful.

A ResourceNotFound error is returned in the following scenarios:

  • If no Customer exists with the id specified in the customer:{id} scope.
  • If the Customer exists but is associated with a different Store than what is specified in the manage_my_profile:{projectKey}:{storeKey} scope.
OAuth 2.0 Scopes:
manage_my_profile:{projectKey}manage_my_profile:{projectKey}:{storeKey}customer_id:{id}
Path parameters:
region
String

Region in which the Project is hosted.

projectKey
String

key of the Project.

storeKey
String

key of the Store.

Query parameters:
version
Int

Last seen version of the resource.

Response:
200Customerasapplication/json
Request Example:cURL
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/in-store/key={storeKey}/me?version={version} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
200 Response Example: Customerjson
{
"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"
}