It is permissible to keep animals as pets, and even keep them in a cage, as long as they are properly taken care of. There was a young boy in the city of Madīnah who kept a bird as a pet in his house and the Prophet asked him how the bird was doing, but did not criticize the fact that it was kept as a pet. [Bukhārī & Muslim].
God knows best,
Imam Mustafa Umar