As of the 1.40 update, players were allowed to add Keys into courses.
Keys can be placed in blocks, or in an enemy, such as making them obtainable after Mario defeats it. Thus, this also makes some enemies having to be defeated in order to procceed through the level. After obtaining the key, the player has to bring it to a Key Door and unlock it. A key doesn't need to be directly held onto by Mario, as it just automatically follows him after obtaining it, functioning similarly to the keys in the Yoshi's Island series. Up to eight keys can be obtained at one time.
Additionally, another new item included in the update, the Pink Coin, reveals a key once Mario collects every single one in the level.