The Messenger of Allah ﷺ was cupped on his head while in a state of ihram, due to an ailment he was suffering from.
حدثنا عثمان بن أبي شيبة حدثنا يزيد بن هارون أخبرنا هشام عن عكرمة
أن رسول الله ﷺ احتجم وهو محرم في رأسه من داء كان به
No references are available.
Bukhari transmitted it in the Book of Medicine, Chapter on Cupping for Migraine and Headache, no. 5700, from the hadith of Hisham, through this same chain.