Can't set newly added email to primary


I am trying to update the email of an account. I successfully added it but can’t set it to primary. Please guide how can I set an email address to primary through API.

This is how I have been trying. The newly added email is successfully getting linked with the account but not just being settled to primary. Any help will be appreciated. Thanks!