Security and access

What an API key is, and why it isn’t a password

Your tools may run on keys you have never seen. Each one is worth a few minutes of checks.

By the duyan team · Updated · 3 min read

Security and access

In short

  • An API key lets a program use a service through your account.
  • It has no second check, so whoever holds it can use it.
  • You can make many keys, each with its own limits.
  • Keys leak from files and scripts, and a leaked key works until someone deletes it.
  • Keep each key narrow, stored safely and in your own account.

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

How a key differs from your password
Your passwordAn API key
Who uses itYou, at a login screenA program, on every request
How manyOne per accountAs many as you create
What it allowsEverything your account can doWhat you set, where the service offers limits
Second checkUsually a code or a prompt on your phoneNone
If it leaksYour whole account is openOnly 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.

Want someone to check yours?

We review software, automations and agents that you or someone else built, and list what we’d fix first. About a week, $1,200 fixed, and you keep the written findings either way.

Sources

  1. Google Cloud, “Best practices for managing API keys”, docs.cloud.google.com (accessed 5 November 2026)
  2. Stripe Docs, “API keys”, docs.stripe.com (accessed 5 November 2026)
  3. Amazon Web Services, “Manage access keys for IAM users”, docs.aws.amazon.com (accessed 5 November 2026)
  4. GitGuardian, “The State of Secrets Sprawl 2026” (published 17 March 2026), gitguardian.com (accessed 5 November 2026)
  5. GitHub Blog, “GitHub found 39M secret leaks in 2024. Here’s what we’re doing to help” (1 April 2025), github.blog (accessed 5 November 2026)
  6. OpenAI Help Center, “Managing projects in the API platform” (Choose key permissions), help.openai.com (accessed 5 November 2026)
  7. GitHub Docs, “Managing your personal access tokens”, docs.github.com (accessed 5 November 2026)
  8. Microsoft Learn, “Revoke user access in an emergency in Microsoft Entra ID”, learn.microsoft.com (accessed 5 November 2026)
  9. GitHub Docs, “Managing deploy keys”, docs.github.com (accessed 5 November 2026)
  10. Google Cloud, “Best practices for managing service account keys”, docs.cloud.google.com (accessed 5 November 2026)
  11. OpenAI, “API reference: overview” (Authentication), developers.openai.com (accessed 5 November 2026)

Bring your hardest question

Ask us about keys, access, where your data goes or who can switch it off.

Read⁠-⁠only by default. Your keys stay yours.