Miqdam bin Maadi reported,

He heard the Messenger of Allah ﷺ say, "Hosting a guest for one night is an obligation upon every Muslim. If a guest spends the night in someone's courtyard and is denied hospitality, it becomes a debt owed to him. If he wishes, he may claim it, and if he wishes, he may forgive it."

Azami 14440

Sahih

عن المقدام بن معدي كرب أبي كريمة

أنه سمع رسول الله ﷺ يقول: ليلة الضيف واجبة على كل مسلم، فإن أصبح بفنائه محروما كان دينا له عليه إن شاء اقتضاه، وإن شاء تركه.

الأعظمي 14440صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Superior moral conduct
Chapter
Etiquette of hospitality, and feeding food
Section
Right of the guest
Numbering
Jami al-Kamil 14440 (2nd edition)
Azami 14440