Hadithcore
Sahih al-Bukhari, 4172
sahih

Narrated Anas bin Malik:

regarding Allah's Statement: "Verily! We have granted you (O, Muhammad) Manifest victory." (48:1) It refers to the Al-Hudaibiya Pledge. And the companions of the Prophet (ﷺ) said (to the Prophet), "Congratulations and happiness for you; but what reward shall we get?" So Allah revealed:-- "That He may admit the believing men and women to gardens beneath which rivers flow." (48:5)

حَدَّثَنِي أَحْمَدُ بْنُ إِسْحَاقَ، حَدَّثَنَا عُثْمَانُ بْنُ عُمَرَ، أَخْبَرَنَا شُعْبَةُ، عَنْ قَتَادَةَ، عَنْ أَنَسِ بْنِ مَالِكٍ ـ رضى الله عنه ‏{‏إِنَّا فَتَحْنَا لَكَ فَتْحًا مُبِينًا‏}‏ قَالَ الْحُدَيْبِيَةُ‏.‏ قَالَ أَصْحَابُهُ هَنِيئًا مَرِيئًا فَمَا لَنَا فَأَنْزَلَ اللَّهُ ‏{‏لِيُدْخِلَ الْمُؤْمِنِينَ وَالْمُؤْمِنَاتِ جَنَّاتٍ‏}‏ قَالَ شُعْبَةُ فَقَدِمْتُ الْكُوفَةَ فَحَدَّثْتُ بِهَذَا كُلِّهِ عَنْ قَتَادَةَ ثُمَّ رَجَعْتُ فَذَكَرْتُ لَهُ فَقَالَ أَمَّا ‏{‏إِنَّا فَتَحْنَا لَكَ‏}‏ فَعَنْ أَنَسٍ، وَأَمَّا هَنِيئًا مَرِيئًا فَعَنْ عِكْرِمَةَ‏.‏

References2 variants
In-Book Reference
Book 64, Hadith 214
USC-MSA web (English) reference
Vol. 5, Book 59, Hadith 490 (deprecated numbering scheme)