HTTP 401 · Unauthorized
HTTP 401 Users & Peers

When & why it happens

The account was banned by Telegram for ToS violations. The account is permanently unusable.

Handling in gogram

Surfaced as *gogram.ErrResponseCode. Match on the message:

if err, ok := err.(*gogram.ErrResponseCode); ok { if err.Message == "USER_DEACTIVATED_BAN" { // handle this error } }