HTTP 401 · Unauthorized
HTTP 401 Users & Peers

When & why it happens

The account has been deactivated (deleted by the user or by Telegram). No further requests will succeed on this auth key.

Handling in gogram

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

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