The Castle Key was used to open locked doors in castles.
In Paper Mario. They were used in Tubba Blubba's Castle, Bowser's flying castle, and Peach's Castle. Tubba Blubba's keys look like three leaf clovers, while Bowser's look like a gold three leaf clover with a blue ball in the middle. There are about three of Tubba's keys and five of Bowser's keys. Peach's Castles keys are pink versions of Bowser's.
In Paper Mario: The Thousand-Year Door, the Castle Keys that open the doors in Hooktail Castle are shaped like crowns.