Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:37:102

And when he reached with him ˹the age of˺ exertion, he said, "O my son, indeed I have seen in a dream that I ˹must˺ sacrifice you, so see what you think." He said, "O my father, do as you are commanded. You will find me, if Allah wills, of the steadfast."  

And when he was old enough to walk with him, that is, to go about with him and help him out — this is said to have been ˹either˺ at the age of seven or at the age of thirteen — he said, ‘O my dear son, I see, that is, I have seen, in a dream that I shall sacrifice you — and the visions of prophets are ˹always˺ true and their actions are ˹inspired˺ by the command of God, exalted be He. So see what you think’, of this dream. He consulted him so that he ˹his son˺ might accept the idea of being sacrificed and comply with the command for it. He said, ‘O my father (the ˹final˺ tā’ ˹in abati˺ replaces the yā’ of the genitive ˹possessive˺ annexation ˹yā abī˺) do whatever you have been commanded, to do. You shall find me, God willing, of the steadfast’, in this ˹affair˺.
القرآن:٣٧:١٠٢

فَلَمَّا بَلَغَ مَعَهُ السَّعْيَ قَالَ يَا بُنَيَّ إِنِّي أَرَىٰ فِي الْمَنَامِ أَنِّي أَذْبَحُكَ فَانْظُرْ مَاذَا تَرَىٰ ۚ قَالَ يَا أَبَتِ افْعَلْ مَا تُؤْمَرُ ۖ سَتَجِدُنِي إِنْ شَاءَ اللَّهُ مِنَ الصَّابِرِينَ  

{فلما بلغ معه السعي} أي أن يسعى معه ويعينه قيل بلغ سبع سنين وقيل ثلاث عشرة سنة {قال يا بنيَّ إني أرى} أي رأيت {في المنام أني أذبحك} ورؤيا الأنبياء حق وأفعالهم بأمر الله تعالى {فانظر ماذا ترى} من الرأي شاوره ليأنس بالذبح وينقاد للأمر به {قال يا أبت} التاء عوض عن ياء الإضافة {افعل ما تؤمر} به {ستجدني إن شاء الله من الصابرين} على ذلك.