Keys are items unlocked by completing a level for the first time. They are used to unlock some levels. The first level to need keys to be unlocked was Level 10: Castle in the Sky. The made their debut in Update 1.2.8, which was released on September 24, 2016. Levels finished before this update need to be finished again in order to obtain keys.
You can also buy 3 times more keys for $0.99 ($1.00), and 10 times more keys for $2.99 ($3.00)