Sunan an-Nasa'i #19 · The Book of Purification

Sunan an-Nasa'iIt was narrated that Anas bin Malik said
Sunan an-Nasa'i · Book 1 · The Book of Purification
Sunan an-Nasa'i · كتاب 1 · كتاب الطهارة
"The Messenger of Allah (ﷺ) entered Al-Khala' (the toilet) and said: 'Allahumma inni a'uthu bika min al-khubuthi wal-khaba'ith (O Allah, I seek refuge with You from male and female devils)."[1] [1] See Ma'alam As-Sunan by Al-Khattabi. And Al-Khala' is the area one relieves oneself in. It refers to outside or other than that, it should not be understood to mean toilet only
أَخْبَرَنَا إِسْحَاقُ بْنُ إِبْرَاهِيمَ، قَالَ أَنْبَأَنَا إِسْمَاعِيلُ، عَنْ عَبْدِ الْعَزِيزِ بْنِ صُهَيْبٍ، عَنْ أَنَسِ بْنِ مَالِكٍ، قَالَ كَانَ رَسُولُ اللَّهِ صلى الله عليه وسلم إِذَا دَخَلَ الْخَلاَءَ قَالَ ‏
"‏ اللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنَ الْخُبُثِ وَالْخَبَائِثِ ‏"‏ ‏.‏
Reference : Sunan an-Nasa'i 19In-book reference : Book 1, Hadith 19