كتاب المغازى
64  
Military Expeditions led by the Prophet (pbuh) (Al-Maghaazi)
(29)
Chapter: The Ghazwa of Al-Khandaq or Al-Ahzab Battle
(29)
باب غَزْوَةُ الْخَنْدَقِ وَهْىَ الأَحْزَابُ
Sahih al-Bukhari 4097

Narrated Ibn `Umar:

That the Prophet (ﷺ) inspected him on the day of Uhud while he was fourteen years old, and the Prophet (ﷺ) did not allow him to take part in the battle. He was inspected again by the Prophet (ﷺ) on the day of Al- Khandaq (i.e. battle of the Trench) while he was fifteen years old, and the Prophet (ﷺ) allowed him to take Part in the battle.

حَدَّثَنَا يَعْقُوبُ بْنُ إِبْرَاهِيمَ، حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ، عَنْ عُبَيْدِ اللَّهِ، قَالَ أَخْبَرَنِي نَافِعٌ، عَنِ ابْنِ عُمَرَ ـ رضى الله عنهما أَنَّ النَّبِيَّ صلى الله عليه وسلم عَرَضَهُ يَوْمَ أُحُدٍ وَهْوَ ابْنُ أَرْبَعَ عَشْرَةَ فَلَمْ يُجِزْهُ، وَعَرَضَهُ يَوْمَ الْخَنْدَقِ وَهْوَ ابْنُ خَمْسَ عَشْرَةَ فَأَجَازَهُ‏.‏
Reference : Sahih al-Bukhari 4097
In-book reference : Book 64, Hadith 141
USC-MSA web (English) reference : Vol. 5, Book 59, Hadith 423
  (deprecated numbering scheme)