Is there a way to replace user's role using the API?

Description

Is there a way to replace existing role for the user or remove all roles and add a new one? I found an API that would allow me to add role to a user. But, I can’t find a way to remove old role before adding a new one.

https://developer.rocket.chat/api/rest-api/methods/roles/addusertorole

How can I replace current user’s role?

Hi.

Hmm - Can’t see one.

I can see they recently introduced this though not sure there an endpoint for it yet.

removeRolesByTeamIdAndUserId(teamId: string, userId: string, roles: Array<string>): Promise<UpdateWriteOpResult> {

I guess the risk is trying to remove a role with users still in it.

You could add a feature request.