Hisham ibn 'Urwa reported that: Ibn az-Zubayr was in Makka and the Companions of the Prophet, may Allah bless him and grant him peace, were carrying birds in cages.
Commentary: So from this narrative it is permissible to put the birds in cages.
This is because Abdullah ibn Zubayr, who did not object, is one of the great Companions. In the hadith, other Companions also are mentioned. It was narrated by people who saw it, and al-Bukhari included it in his books.
From this narration the verdict is that it is permissible to put the bird in the cage. Many people have been asking this question many times, and it is clear in this hadith.
Anas said, "The Prophet, may Allah bless him and grant him peace, came in and saw a son of Abu Talha's called Abu Umayr. He had a sparrow which he used to play with." He said, "Abu 'Umayr, what happened to (or where is) the little sparrow?'"
Commentary: The fact that a child was playing with a bird, the Prophet (may Allah bless him and grant him peace) did not object to this and made a joke, makes it clear that it is possible to play with birds.