What an API key is
An API key is a long secret code that lets a program use a service through your account. The program sends the key with each request, and the service allows whatever that key permits.
An API is the way a service lets other programs in. The key decides who gets in, and how far.
How a key works in practice
You create a key in the service’s settings, then paste it into the tool that needs it. Many services show the full key only once, so you copy it then.
From then on, the key works for anyone who has it. Google calls API keys “bearer credentials”, which means the holder can use them.
There is no login screen and no code from your phone. A key copied to the wrong place works just as well for a stranger.
How a key differs from your password
| Your password | An API key | |
|---|---|---|
| Who uses it | You, at a login screen | A program, on every request |
| How many | One per account | As many as you create |
| What it allows | Everything your account can do | What you set, where the service offers limits |
| Second check | Usually a code or a prompt on your phone | None |
| If it leaks | Your whole account is open | Only what that key allows, until it’s deleted |
So a key is the right thing to hand to a program. You can limit it, and you can cut it off without changing your own login.
Why keys leak more easily
A password lives in your head or your password manager. A key lives wherever a program needs it, such as a settings file, a script or a shared document.
Keys left in code are common. GitGuardian counted 28.6 million new secrets, such as keys and passwords, in public GitHub code during 2025.
A leaked key stays dangerous until someone deletes it. Of the working secrets GitGuardian found in 2022, 64% still worked in January 2026.
What it means for you
Ask for the narrowest key the service offers. Stripe’s restricted keys let you set each area to none, read or write.
OpenAI lets you make a key read-only or restricted. GitHub’s fine-grained tokens cover only the repositories you pick, and can expire.
A key to an AI provider also spends your money. Put a monthly limit on the account it belongs to.
Common mix-ups
- Key or token. A token usually comes from clicking “Allow” on a sign-in screen, and it expires. Microsoft’s access tokens last 1 hour by default, while many keys work until someone deletes them.
- Keys meant to be public. Stripe’s publishable key is built to sit in web pages. Its secret and restricted keys must stay hidden.
- Removing the person. Deleting a contractor’s account doesn’t always remove keys they made. A GitHub deploy key, for example, keeps working after the person who added it leaves.
What to ask or check
- Whose account was each key created in? It should be yours.
- What can each key do, and is a narrower one on offer?
- Where is it stored? A password manager or the tool’s secret settings are the right places.
- When was it last used? Stripe shows request logs for each key, and Google Cloud shows when a service account key was last used.
- Who can delete it, and how fast does that work? OpenAI says a deleted key stops working within a few seconds.
