How to Reset Phone Number For 2FA Via API

When a recent phone number change is preventing a successful login within a Cloud Elements account due to 2FA option, it is good to know that the phone number reset is available through the API calls. In order to perform this action, you need the User Secret and Organization Secret related to the Cloud Elements account in question before following these steps: 


1. A GET call to retrieve the account id:

  curl -X GET 
  https://api.cloud-elements.com/elements/api-v2/accounts 
  -H 'Authorization: User *******, Organization *******' 
  -H 'accept: application/json' 


2. A second GET call to retrieve all the available users related to that account id

curl -X GET \
 https://api.cloud-elements.com/elements/api-v2/accounts/YourAccountID/users 
  -H 'Authorization: User *******, Organization *******' 
  -H 'accept: application/json' 

 
3. Using the response body from the step 2 retrieve the user id related to the email address in question and perform the PATCH call to update the phone field

curl -X PATCH \
  https://api.cloud-elements.com/elements/api-v2/accounts/YourAccountID/users/YourUserID 
  -H 'Authorization: User *******, Organization *******' 
  -H 'Content-Type: application/json' 
  -H 'accept: application/json' 
  -d '{ "phone": "YourNewPhoneNumber" }'


Note: Once all these steps have been performed and login to CE account the new phone number will be required to be confirmed. 


Here is a sample video how all the API calls work.