How to Modify Customer Account

Ensure that the customer is authenticated before making a request to update the customer account.

In the request body, include all the properties that should be updated with their new values. Properties that doesn't need to be updated can be omitted or could be passed in the request body with their current values.

Ensure that you exclue the properties that are not allowed to be updated (birthday as part of the customer demographic data can't be updated once it's set).

Please note that depending on the Brand's customer authentication settings, customer's email or phone number needs to be updated in a specific flow that will be explained later. That is neccessary because with Phone number customer auth type, customer's phone number needs to be validated using OTP and in the Email customer auth type we need to validate the email in the same way.

customer-accounts/{customer_account_id}/update

Request

Attribute Type Example Value Description
Authorization HTTP header string "Bearer {customer_account_token}" JWT Token of Customer Account
first_name varchar "John" Customer's name
last_name varchar "Doe" Customer's last name
optin_status_email tinyint (optional) 1 How the opt-in for marketing emails is handled depends on the Brand's opt-in settings. More information can be found in the "Opt-in" section of the 'How to view/edit basic information about my Brand' knowledge base article.
optin_status_sms tinyint (optional) 2 Customer's opt-in status for marketing SMS. Values: 1 confirmed, 2 disabled, 3 pending.
optin_status_pn tinyint (optional) 3 Customer's opt-in status for marketing push notifications. Values: 1 confirmed, 2 disabled, 3 pending.
demographics Demographic resource (optional) Can be required depending on the Brand's customer demographic data settings.
phone_number varchar "+15852826524" If the brand is using the Email customer auth type, phone number can be passed as a property in the customer account update call. Depending on the 'Phone number unique' configuration, check if the new phone number that customer provided is unique inside the system might be required (as already explained in the Customer Sign-Up Flow guide). In brands that use the Phone number customer auth, updating phone number must be done through specific flow in order to validate that customer owns the new number.
email varchar "jon.doe@gmail.com If the brand is using the Phone number customer auth type, customer's email can be passed as a propery in the customer account update call. Before sending the request to update customer's email check if the new email that customer provided is unique inside the system is required (as already explained in the Customer Sign-Up Flow guide). In brands that use the Email customer auth, updating customer's email must be done through specific flow in order to validate that customer owns the new number.
{
  "method": "put",
  "url": "https://api-public-playground.menu.app/api/customer-accounts/{customer_account_id}",
  "headers": {
    "X-Request-ID": "69da3547-204b-4093-a225-54e084c24215",
    "Application": "f3a90488ffee32c3acb6fcd0ca417cf6",
    "Api-Version": 4.38.0,
    "Content-Type": "application/json",
    "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzZXRSZWZyZXNoVFRMIjoyNjI4MDAwLCJpc3MiOiJodHRwczovL2FwaS1wdWJsaWMtcGxheWdyb3VuZC5tZW51LmFwcC9hcGkvY3VzdG9tZXJzL2xvZ2luIiwiaWF0IjoxNjkzMjA0MTQ3LCJleHAiOjE2OTMyMDc3NDcsIm5iZiI6MTY5MzIwNDE0NywianRpIjoiM0RiTngwVlB6VmpTTlJkdyIsInN1YiI6IjUwOTA5NjUiLCJwcnYiOiJjYzMyOTIxYTE1NDgwYTExN2Q5YmJjNzJjMGUxMjU2YTY4NTI0NThiIiwiYXBwbGljYXRpb25faWQiOjIwMTUsInNlc3Npb25faWQiOjI4MzQyfQ.1J3_OlydWh32BUNAySZ6Qbj1K0q-_w4KfFnra2X9FbM"
  },
  "body": {
    
     "first_name": "Jonathan",
     "optin_status_email": "2"
   
  }
}

Response

{
  "status": "OK",
  "code": 200,
  "data": {
    "customer_account": {
      "id": "0ff757dd-9b8a-4750-89ad-03ff531ae923",
      "type_id": 1,
      "reference_type": "CustomerAccount",
      "first_name": "Jonathan",
      "last_name": "Doe",
      "email": "john.doe@gmail.com",
      "phone_number": "",
      "locale": "en-US",
      "state": 1,
      "demographics": [],
      "optin_status_email": 2,
      "optin_status_pn": 3,
      "has_pending_email_change": false,
      "has_pending_phone_number_change": false,
      "is_social": false,
      "social_login": null,
      "updated_at": "2023-08-28 06:37:34",
      "created_at": "2023-08-24 15:33:27"
    }
  }
}

How to modify customer's email in a brand that is using Email customer auth method

Before we update customer's email address we need to make sure that new email address is owned by the customer by sending an email with the one time password that needs to be provided for the change to take effect.

Sending the OTP to the new email address is trigered by passing the new email in the body of the customer update call

customer-accounts/{customer_account_id}/update

Request

Attribute Type Example Value Description
Authorization HTTP header string "Bearer {customer_account_token}" JWT Token of Customer Account
email varchar "john.doa@gmail.com" Customer's new email address
{
  "method": "put",
  "url": "https://api-public-playground.menu.app/api/customer-accounts/{customer_account_id}",
  "headers": {
    "X-Request-ID": "69da3547-204b-4093-a225-54e084c24215",
    "Application": "f3a90488ffee32c3acb6fcd0ca417cf6",
    "Api-Version": 4.38.0,
    "Content-Type": "application/json",
    "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzZXRSZWZyZXNoVFRMIjoyNjI4MDAwLCJpc3MiOiJodHRwczovL2FwaS1wdWJsaWMtcGxheWdyb3VuZC5tZW51LmFwcC9hcGkvY3VzdG9tZXJzL2xvZ2luIiwiaWF0IjoxNjkzMjA0MTQ3LCJleHAiOjE2OTMyMDc3NDcsIm5iZiI6MTY5MzIwNDE0NywianRpIjoiM0RiTngwVlB6VmpTTlJkdyIsInN1YiI6IjUwOTA5NjUiLCJwcnYiOiJjYzMyOTIxYTE1NDgwYTExN2Q5YmJjNzJjMGUxMjU2YTY4NTI0NThiIiwiYXBwbGljYXRpb25faWQiOjIwMTUsInNlc3Npb25faWQiOjI4MzQyfQ.1J3_OlydWh32BUNAySZ6Qbj1K0q-_w4KfFnra2X9FbM"
  },
  "body": {
    
     "email": "john.doe@yahoo.com"
   
  }
}

Response

{
  "status": "OK",
  "code": 200,
  "data": {
    "customer_account": {
      "id": "0ff757dd-9b8a-4750-89ad-03ff531ae923",
      "type_id": 1,
      "reference_type": "CustomerAccount",
      "first_name": "Jonathan",
      "last_name": "Doe",
      "email": "john.doe@gmail.com",
      "phone_number": "",
      "locale": "en-US",
      "state": 1,
      "demographics": [],
      "optin_status_email": 2,
      "optin_status_pn": 3,
      "has_pending_email_change": false,
      "has_pending_phone_number_change": false,
      "is_social": false,
      "social_login": null,
      "updated_at": "2023-08-28 06:37:34",
      "created_at": "2023-08-24 15:33:27"
    }
  }
}

To complete the update of customer's email address we need to pass the OTP that customer got in the email in the body of the following call:

customer-accounts/{customer_account_id}/verify-email-update

Request

Attribute Type Example Value Description
Authorization HTTP header string "Bearer {customer_account_token}" JWT Token of Customer Account
confirmation_code varchar "053631" One time password that was sent to customer's phone number
{
  "method": "put",
  "url": "https://api-public-playground.menu.app/api/customer-accounts/{customer_account_id}/verify-email-update",
  "headers": {
    "X-Request-ID": "69da3547-204b-4093-a225-54e084c24215",
    "Application": "f3a90488ffee32c3acb6fcd0ca417cf6",
    "Api-Version": 4.38.0,
    "Content-Type": "application/json",
    "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzZXRSZWZyZXNoVFRMIjoyNjI4MDAwLCJpc3MiOiJodHRwczovL2FwaS1wdWJsaWMtcGxheWdyb3VuZC5tZW51LmFwcC9hcGkvY3VzdG9tZXJzL2xvZ2luIiwiaWF0IjoxNjkzMjA0MTQ3LCJleHAiOjE2OTMyMDc3NDcsIm5iZiI6MTY5MzIwNDE0NywianRpIjoiM0RiTngwVlB6VmpTTlJkdyIsInN1YiI6IjUwOTA5NjUiLCJwcnYiOiJjYzMyOTIxYTE1NDgwYTExN2Q5YmJjNzJjMGUxMjU2YTY4NTI0NThiIiwiYXBwbGljYXRpb25faWQiOjIwMTUsInNlc3Npb25faWQiOjI4MzQyfQ.1J3_OlydWh32BUNAySZ6Qbj1K0q-_w4KfFnra2X9FbM"
  },
  "body": {
    
     "confirmation_code": "625789"
   
  }
}

Response

{
  "status": "OK",
  "code": 200,
  "data": {
    "customer_account": {
      "id": "0ff757dd-9b8a-4750-89ad-03ff531ae923",
      "type_id": 1,
      "reference_type": "CustomerAccount",
      "first_name": "Jonathan",
      "last_name": "Doe",
      "email": "john.doe@yahoo.com",
      "phone_number": "",
      "locale": "en-US",
      "state": 1,
      "demographics": [],
      "optin_status_email": 2,
      "optin_status_pn": 3,
      "has_pending_email_change": false,
      "has_pending_phone_number_change": false,
      "is_social": false,
      "social_login": null,
      "updated_at": "2023-08-28 06:54:56",
      "created_at": "2023-08-24 15:33:27"
    }
  }
}

How to modify customer's phone number in a brand that is using Phone number customer auth method

Before we update customer's phone number we need to make sure that new phone number is owned by the customer by sending an SMS with the one time password that needs to be provided for the change to take effect.

Sending the OTP to the new phone number is trigered by passing the new phone number in the body of the customer update call

customer-accounts/{customer_account_id}/update]

Request

Attribute Type Example Value Description
Authorization HTTP header string "Bearer {customer_account_token}" JWT Token of Customer Account
phone_number varchar "+15852826525" Customer's new phone number
{
  "method": "put",
  "url": "https://api-public-playground.menu.app/api/customer-accounts/{customer_account_id}",
  "headers": {
    "X-Request-ID": "69da3547-204b-4093-a225-54e084c24215",
    "Application": "f3a90488ffee32c3acb6fcd0ca417cf6",
    "Api-Version": 4.38.0,
    "Content-Type": "application/json",
    "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzZXRSZWZyZXNoVFRMIjoyNjI4MDAwLCJpc3MiOiJodHRwczovL2FwaS1wdWJsaWMtcGxheWdyb3VuZC5tZW51LmFwcC9hcGkvY3VzdG9tZXJzL2xvZ2luIiwiaWF0IjoxNjkzMjA3MjA1LCJleHAiOjE2OTMyMTA4MDUsIm5iZiI6MTY5MzIwNzIwNSwianRpIjoiZUNUNGlZcVZKTGFmdlNIYSIsInN1YiI6IjUwOTA5NzYiLCJwcnYiOiJjYzMyOTIxYTE1NDgwYTExN2Q5YmJjNzJjMGUxMjU2YTY4NTI0NThiIiwiYXBwbGljYXRpb25faWQiOjIxNDQsInNlc3Npb25faWQiOjI4MzUwfQ.0WWTS1RxwPELOPIHV6MAB-XYQCsG7ocS1XvRvc5Vc6w"
  },
  "body": {
    
     "phone_number": "+15852826525"
   
  }
}

Response

{
  "status": "OK",
  "code": 200,
  "data": {
    "customer_account": {
      "id": "8100bab1-267e-41ae-8592-c229253b0129",
      "type_id": 1,
      "reference_type": "CustomerAccount",
      "first_name": "Jonh",
      "last_name": "Doe",
      "email": "john.doe@gmail.com",
      "phone_number": "+15852826524",
      "locale": "en-US",
      "state": 1,
      "demographics": [],
      "optin_status_email": 3,
      "optin_status_pn": 3,
      "has_pending_email_change": false,
      "has_pending_phone_number_change": true,
      "is_social": false,
      "social_login": null,
      "updated_at": "2023-08-25 12:10:33",
      "created_at": "2023-08-25 12:10:33"
    }
  }
}

To complete the update of customer's phone number we need to pass the OTP that customer got in the email in the body of the following call:

customer-accounts/{customer_account_id}/verify-phone-number-update]

Request

Attribute Type Example Value Description
Authorization HTTP header string "Bearer {customer_account_token}" JWT Token of Customer Account
confirmation_code varchar "053631" One time password that was sent to customer's phone number
{
  "method": "put",
  "url": "https://api-public-playground.menu.app/api/customer-accounts/{customer_account_id}/verify-phone-number-update",
  "headers": {
    "X-Request-ID": "69da3547-204b-4093-a225-54e084c24215",
    "Application": "f3a90488ffee32c3acb6fcd0ca417cf6",
    "Api-Version": 4.38.0,
    "Content-Type": "application/json",
    "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzZXRSZWZyZXNoVFRMIjoyNjI4MDAwLCJpc3MiOiJodHRwczovL2FwaS1wdWJsaWMtcGxheWdyb3VuZC5tZW51LmFwcC9hcGkvY3VzdG9tZXJzL2xvZ2luIiwiaWF0IjoxNjkzMjA3MjA1LCJleHAiOjE2OTMyMTA4MDUsIm5iZiI6MTY5MzIwNzIwNSwianRpIjoiZUNUNGlZcVZKTGFmdlNIYSIsInN1YiI6IjUwOTA5NzYiLCJwcnYiOiJjYzMyOTIxYTE1NDgwYTExN2Q5YmJjNzJjMGUxMjU2YTY4NTI0NThiIiwiYXBwbGljYXRpb25faWQiOjIxNDQsInNlc3Npb25faWQiOjI4MzUwfQ.0WWTS1RxwPELOPIHV6MAB-XYQCsG7ocS1XvRvc5Vc6w"
  },
  "body": {
    
     "confirmation_code": "554523"
   
  }
}

Response

{
  "status": "OK",
  "code": 200,
  "data": {
    "customer_account": {
      "id": "8100bab1-267e-41ae-8592-c229253b0129",
      "type_id": 1,
      "reference_type": "CustomerAccount",
      "first_name": "Jonh",
      "last_name": "Doe",
      "email": "john.doe@gmail.com",
      "phone_number": "+15852826525",
      "locale": "en-US",
      "state": 1,
      "demographics": [],
      "optin_status_email": 3,
      "optin_status_pn": 3,
      "has_pending_email_change": false,
      "has_pending_phone_number_change": false,
      "is_social": false,
      "social_login": null,
      "updated_at": "2023-08-28 07:29:58",
      "created_at": "2023-08-25 12:10:33"
    }
  }
}