account.updateUsername

Changes username for the current user.

userEmpty#200250ba id:int = User;
userSelf#7007b451 id:int first_name:string last_name:string username:string phone:string photo:UserProfilePhoto status:UserStatus inactive:Bool = User;
userContact#cab35e18 id:int first_name:string last_name:string username:string access_hash:long phone:string photo:UserProfilePhoto status:UserStatus = User;
userRequest#d9ccc4ef id:int first_name:string last_name:string username:string access_hash:long phone:string photo:UserProfilePhoto status:UserStatus = User;
userForeign#75cf7a8 id:int first_name:string last_name:string username:string access_hash:long photo:UserProfilePhoto status:UserStatus = User;
userDeleted#d6016d7a id:int first_name:string last_name:string username:string = User;
---functions---
account.updateUsername#3e0bdd7c username:string = User;

Parameters

Name Type Description
username string username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.

Result

User

Possible errors

Code Type Description
400 USERNAME_INVALID The provided username is not valid.
400 USERNAME_NOT_MODIFIED The username was not modified.
400 USERNAME_OCCUPIED The provided username is already occupied.
400 USERNAME_PURCHASE_AVAILABLE The specified username can be purchased on https://fragment.com.