Sunan an-Nasa'i, Book 35, Hadith 61 (In-Book)

It was narrated that Ibn 'Umar said: "Umar had made a vow to spend a night in 'Itikaf in Al-Masjid Al-Haram. He asked the Messenger of Allah about that, and he ordered him to perform the 'Itikaf."

أَخْبَرَنَا مُحَمَّدُ بْنُ عَبْدِ اللَّهِ بْنِ يَزِيدَ، قَالَ حَدَّثَنَا سُفْيَانُ، عَنْ أَيُّوبَ، عَنْ نَافِعٍ، عَنِ ابْنِ عُمَرَ، قَالَ كَانَ عَلَى عُمَرَ نَذْرٌ فِي اعْتِكَافِ لَيْلَةٍ فِي الْمَسْجِدِ الْحَرَامِ فَسَأَلَ رَسُولَ اللَّهِ صلى الله عليه وسلم عَنْ ذَلِكَ فَأَمَرَهُ أَنْ يَعْتَكِفَ ‏.‏

sunnah.com