Narrated 'Umar (RA):
[concerning his consultation with the Prophet] He said: I said: O Allah's Messenger (ﷺ), I made a vow in the Jahiliyya times to spend a night in devotion (I'tikaf) in the Sacred Mosque. He (the Prophet) said: "Fulfill your vow."[Agreed upon]. al-Bukhari added in another narration: "Then, spend a night in devotion (in the Sacred Mosque)." (ES)
Reference (ES): Bulugh al-Maram 1396 (ES)
In-book reference (ES): Book 13, Hadith 23 (ES)
English translation (ES): Book 13, Hadith 1396 (ES)