Whenever the Messenger of Allah ﷺ came out from relieving himself, he would say, "I seek Your forgiveness."Abu al-Hasan bin Salama said, Abu Hatim reported to us, Abu Ghassan al-Nahdi narrated to us, Israil narrated to us something similar.
حدثنا أبو بكر بن أبي شيبة حدثنا يحيى بن أبي بكير حدثنا إسرائيل حدثنا يوسف بن أبي بردة قال سمعت أبي يقول دخلت على
كان رسول الله ﷺ إذا خرج من الغائط قال غفرانك قال أبو الحسن بن سلمة أخبرنا أبو حاتم حدثنا أبو غسان النهدي حدثنا إسرائيل نحوه
No references are available.
Its isnad is sahih. Abu Dawud narrated it in the chapter on purification, in the section on what a man says when he leaves the toilet, hadith no. 30, from the hadith of Israil, with this chain. Tirmidhi graded it hasan, hadith no. 7, and Ibn Khuzayma, Ibn Hibban, Hakim, and Dhahabi graded it sahih.