Code Keys are used to take part in the time limited Events.
Each level of the Events will cost a different value of Code Keys to enter.
You can keep a maximum of 20 Code Keys at a time, and they will regenerate after time. Although if you can't wait, then you can buy a Code Key refresh from the Store!
Or, if you have set aside some time to play the game, why not purchase unlimited code keys! This lasts for an hour and lets you use as many as you can within that time.