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)." (FR)
Reference (FR): Bulugh al-Maram 1396 (FR)
In-book reference (FR): Book 13, Hadith 23 (FR)
English translation (FR): Book 13, Hadith 1396 (FR)