The Messenger of Allah ﷺ had himself cupped when he was fasting. Abu Dawud said: Wuhaib b. Khalid narrated a similar tradition from Ayyub through a different chain of narrators. Ja'far b. Rabi'ah and Hisham, that is, Ibn Hassan, narrated a similar tradition from 'Ikrimah on the authority of Ibn 'Abbas.
أَنَّ رَسُولَ اللَّهِ ﷺ احْتَجَمَ وَهُوَ صَائِمٌ