The Messenger of Allah ﷺ said: “The two parties to a transaction have the option (of cancelling it) so long as they have not parted or there is a condition which gives the option to cancel.ʿ (Using translation from Aḥmad 393)
"إِنَّ المُتَبايِعَيْنِ بِالْخِيَارِ فِى بَيْعِهِما مَا لَمْ يتَفَرَّقا أَوْ يَكُونَ الْبَيْعُ خِيَارًا".