Hadithcore
Hadith #2103750

Narrated [Anas (RA)]:

The Prophet (ﷺ) never used to supplicate [i.e. Qunut in the prayer) except when he prayed for a people or when he prayed against a people. [Ibn Khuzaimah graded it Sahih (authentic)].

وَعَنْهُ أَنَّ اَلنَّبِيَّ ‏- صلى الله عليه وسلم ‏-{ كَانَ لَا يَقْنُتُ إِلَّا إِذَا دَعَا لِقَوْمٍ , أَوْ دَعَا عَلَى قَوْمٍ } صَحَّحَهُ اِبْنُ خُزَيْمَةَ .‏ [1]‏

References2 variants
Sunnah.com reference
Book 2, Hadith 192
Arabic/English book reference
Book 2, Hadith 304