The Messenger of Allah ﷺ had himself cupped in his head when he was in the sacred state (wearing ihram due to a disease from which he was suffering. (Using translation from Abū Dāʾūd 1836)
أَنَّ رَسُولَ اللهِ ﷺ احْتَجَمَ وَهُوَ مُحْرِمٌ فِي رَأْسِهِ مِنْ صُدَاعٍ وَجَدَهُ