account.deleteAccount
Delete the user's account from the telegram servers. Can also be used to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured, see here » for more info on password recovery, and here » for more info on account deletion.
func (c *Client) AccountDeleteAccount(ctx context.Context, request *AccountDeleteAccountRequest) (bool, error)
Calling this method
client.Run(ctx, func(ctx context.Context) error {
api := client.API()
res, err := api.AccountDeleteAccount(ctx, &tg.AccountDeleteAccountRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // bool
return nil
})
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
Reason | string | yes | Why is the account being deleted, can be empty |
Password | InputCheckPasswordSRPClass | — | 2FA password: this field can be omitted even for accounts with 2FA enabled: in this case account account deletion will be delayed by 7 days as specified in the docs » |
Returns
bool
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | PASSWORD_HASH_INVALID | The provided password hash is invalid. |
References
- Official documentation
- Generated Go reference
- TL definition:
account.deleteAccount#a2c0cf74