API key
A secret string that identifies an application when it calls an API. If it is exposed or has too many permissions, it gives access without any login, so keys need limited scope, rotation and monitoring.
Reading Time:
3 min
An API key is a secret string that identifies an application or user when it calls an API. It works like a password for software: whoever holds the key can usually make the calls it allows, often without any further login.
An application sends the key with each request. The service checks it, applies the permissions linked to that key and may record the activity under its name. Keys are easy to create, which is why they appear in scripts, integrations, cloud services and automation.
An API key is a non-human identity: it has access, acts on its own and is rarely reviewed. It needs no password, no MFA and no interaction, so it can be copied once and used from anywhere, at any hour, until someone revokes it.
If a key is exposed, an attacker can use it as a valid identity. Nothing needs to be broken, and the calls look legitimate.
Attackers scan public repositories and shared files for exposed keys, so a leak can be found and used quickly.
A key identifies an application. An OAuth token represents delegated access and usually expires. A password identifies a person and can be backed by MFA. All three are credentials that an attacker can use if they leak, but keys tend to live longest and be watched least.
An API key also often sits behind a service account. The account holds the permissions and the key is the way to use them, so reviewing one without the other leaves a gap.
Keys are fine for simple, low-risk cases. For sensitive access, short-lived tokens, certificates or federated identity are safer, because they expire and can be tied to a specific workload.
Because a key identifies the application, not the person or the context. Logs show that the key was used, not who used it or why. Without a baseline of normal use for each key, a stolen one is hard to tell from the real application.
A key created for a one-off export keeps working after the project ends and nobody owns it. Two years later it appears in a shared document. Nobody notices when it starts being used from a new location.
Revoke it first, then create a replacement with a narrower scope. Review the key’s recent activity to see what was accessed, check connected systems for changes and find out how it leaked, so the same path is closed.
As often as the risk and the platform allow, and always after a suspected exposure. Short-lived credentials reduce the need to rotate by hand.
Start with an inventory, because you cannot protect keys you do not know about. Then give each key an owner and the narrowest scope, store it in a secrets manager, rotate it on a schedule and after any suspected exposure, and retire it when the integration ends. Prefer short-lived credentials where the platform supports them.
Sharelock brings non-human identities into the same view as people, shows which ones hold excessive access and watches how they behave after authentication, so unusual use of a key stands out against its normal pattern.
Explore more terms