Update User profile attribute using the API

Hello,
How can i set “required filed” to false on Realm Settings-> User profile-> Edit attribute using the Api? I am trying to do this on the email attribute
Thank you