der Key
key
A string of characters, a code, or a password needed to encrypt and decrypt data or to access a system.
Kannst du mir den Key für das WLAN geben?
Can you give me the key for the Wi-Fi?

key
Loading your saved state.
key
A string of characters, a code, or a password needed to encrypt and decrypt data or to access a system.
Kannst du mir den Key für das WLAN geben?
Can you give me the key for the Wi-Fi?

The word 'Key' (key) is an Anglicism and is used mainly in colloquial speech and informal contexts. It sounds modern and is often used by younger people.
Gib mir mal schnell den Key für dein Fahrradschloss.
Quick, give me the key for your bike lock.
The meaning is easy to recognize from context. If people are talking about technology, computers, or security, it means a code or password. If it is about abstract things like success or a good relationship, it means the decisive element.
Ich habe den Product Key für die Software verloren.
I lost the product key for the software.
In the technical meaning, 'Key' (key) is often used as part of compounds, such as 'WLAN-Key' (Wi-Fi key), 'Product-Key' (product key), or 'Lizenz-Key' (license key). Typical verbs are 'eingeben' (to enter), 'brauchen' (to need), or 'haben' (to have).
Du musst den 16-stelligen Key eingeben, um das Programm zu aktivieren.
You have to enter the 16-character key to activate the program.
In the metaphorical meaning, the structure '[something] ist der Key für/zu [etwas]' ([something] is the key to/for [something]) is often used to describe a solution or a decisive factor.
Regelmäßiges Üben ist der Key zum Erfolg.
Regular practice is the key to success.
code
'der Code' and 'der Key' can both mean a string of characters that gives you access or protects data. 'Code' is more general and works well for numbers, letters, or symbols used for unlocking, logging in, or encrypting. 'Key' is used mainly in IT when a string of characters functions like a digital key, for example in encryption or access to a system. Learners may confuse the words because both can function like a password. In everyday language, people usually say 'Code'; 'Key' sounds more technical.

Für den sicheren Zugang zum Server braucht Frau Schmidt einen neuen Key.
Ms. Schmidt needs a new key for secure access to the server.
Den Code für die Tür bekommst du heute Morgen per Nachricht.
You'll get the code for the door by message this morning.