Skip to content
Integrations

API Keys Explained: What They Are and How to Keep Them Safe

What an API key is, why tools ask for one, and the simple habits that keep your keys (and your bill) safe from misuse.

By The Internet 101 Team 9 min read
A key resting on a laptop keyboard, representing digital access credentials
Photo via Pexels

Sooner or later, connecting AI to your tools means a screen asks you for an “API key.” If you’ve ever pasted one of these long random strings into a settings box and wondered what exactly you just did, this guide is for you. Knowing what is an API key — and how to handle it — saves you from the two most common headaches: a surprise bill and a leaked credential.

An API key is, at its core, a password for software. When one program needs to use another program’s service — say, your automation tool calling an AI model — it presents a key to prove it’s allowed. The service checks the key, recognizes who it belongs to, and lets the request through.

This article explains what API keys are, why tools ask for them, how they differ from your normal login, and the handful of habits that keep them safe. No coding background required.

What an API key is

When you log into a website, you type a username and password. When one piece of software talks to another through an API, it can’t sit at a login screen — so instead it sends an API key with each request. The key answers a simple question for the service: “Who is making this call, and are they allowed to?”

A few things follow from that:

  • It identifies you. The key is tied to your account, so the service knows whose request it is and whose usage to count.
  • It authorizes the request. A valid key means “let this through.” An invalid or missing one gets rejected.
  • It’s tied to billing. If the service charges by usage — as most AI APIs do — calls made with your key count toward your bill.

That last point is the one people underestimate. Your API key is effectively a spending credential. Anyone who has it can run up usage in your name.

What does a key actually look like? Usually it’s a long, random-looking string of letters and numbers — sometimes with a recognizable prefix that hints at which service it’s for. It’s deliberately long and random so it can’t be guessed. You generate it once from the service’s dashboard, copy it somewhere safe, and from then on it’s the thing your tools present to prove they’re allowed in. Many services only show the full key once at creation time, so if you lose it you generate a new one rather than recovering the old.

Why tools ask for your key

When you connect AI to something — a no-code automation, a browser extension, a spreadsheet add-on — that tool isn’t using its own access to the AI model. It’s using yours. You paste in your key so the tool can make calls to the model on your behalf, billed to your account.

This is normal and often the right design: it means you control the account, you see the usage, and you can cut off access by revoking the key. But it also means you’re trusting that tool to handle your key responsibly. We’ll come back to that.

This is also why it pays to give each tool its own dedicated key rather than reusing one everywhere. If you hand the same key to five different apps and one of them turns out to be sloppy with security, all five connections are compromised at once and you can’t tell which app was at fault. With separate keys, a problem stays contained — you revoke the one key, the other four keep working, and you know exactly which tool to stop trusting.

If the whole API picture is still fuzzy, our plain-English guide to APIs explained simply covers how these calls work in the first place.

It helps to know that not every connection uses a raw API key. When you click “Connect your Google account” or “Sign in with Slack,” you’re usually going through OAuth instead — a flow where you approve access on the service’s own screen and the app receives a token rather than you pasting a key. OAuth is generally the friendlier and safer experience because you never copy a secret around by hand. You’ll typically meet raw API keys when connecting to AI models and developer-focused services, where pasting a key into a settings field is still the norm. Knowing which you’re dealing with tells you how careful to be: a pasted key is a secret you’re now responsible for storing safely.

API key vs password vs token

These terms get muddled, so here’s the quick version:

  • A password logs you (a human) into an account through a login screen.
  • An API key lets software access a service on your behalf, sent automatically with each request.
  • A token (you’ll see “access token” or “OAuth token”) is similar to a key but usually shorter-lived and granted through a more elaborate handshake — common when an app connects to your Google or Slack account.

The practical difference: passwords are for people, keys and tokens are for programs. And unlike a password you keep in your head, a key gets stored somewhere a machine can read it — which is exactly why storing it carefully matters.

There’s a subtle security upside to keys, too. Because a key is separate from your password, you can hand one to a tool without giving away your actual login. The tool can use the service, but it can’t change your password, read your billing details, or lock you out — and you can revoke the key without touching your account login at all. That separation is the whole reason services use keys instead of just asking you to type your password into every app.

A laptop screen showing a settings panel with a hidden secret field

The risks of a leaked key

Because a key is a spending credential, a leaked one can hurt in a few ways:

  • A runaway bill. Someone who finds your AI API key can make calls on your dime until you notice and revoke it.
  • Data exposure. If the key grants access to data (not just a model), a leak can expose that data.
  • Abuse of your account. Attackers scrape public code repositories and forums looking for exposed keys precisely because they’re so easy to misuse.

The most common way keys leak isn’t a dramatic hack — it’s something mundane: a key pasted into a public code repository, a screenshot shared in a chat, or a key left in a config file that ends up somewhere visible. Good habits prevent nearly all of it.

Here are the slip-ups that catch people most often:

  • Committing a key to a public repository. This is the classic one. Automated bots scan public code constantly, and a key in a committed file can be found and abused within minutes.
  • Sharing a screenshot with the key visible. Pasting a settings screen into a chat or a support ticket without blurring the key.
  • Putting the key directly in client-side code. Anything that runs in a browser can be inspected by anyone, so a key embedded there is effectively public.
  • Emailing a key around or dropping it in a shared doc “just for now” — and then forgetting it’s there.

The reassuring part is that every one of these is avoidable with a little discipline. None requires special tooling, just the habit of treating the key like the credential it is.

How to keep your API keys safe

You don’t need to be a security expert. These few practices cover the vast majority of risk:

  1. Treat a key like a password. Never post it in a screenshot, a public repo, a support ticket, or a shared doc. If you wouldn’t share your password that way, don’t share the key.
  2. Don’t hardcode keys. When using a key in code or a tool, store it in a designated secrets field or environment variable, not pasted directly into a file that gets shared or committed.
  3. Use separate keys for separate things. Many services let you create multiple keys. Give each tool its own, so if one leaks you can revoke just that one without breaking everything else.
  4. Scope and limit where you can. Some services let you restrict a key (read-only, certain functions, certain domains) and set usage or spending caps. Use those limits — a capped key can’t run up an unlimited bill.
  5. Rotate keys periodically. Generating a fresh key and retiring the old one limits the damage if an old key quietly leaked.
  6. Revoke immediately if exposed. If a key shows up somewhere public, delete it from the service right away. A revoked key is harmless. Then issue a new one.
  7. Watch your usage. Glance at your usage dashboard now and then. An unexpected spike is often the first sign a key has leaked.

Most of these take seconds and are far less painful than cleaning up after a leak.

A safe setup checklist

When you connect AI to a new tool with a key, run through this:

  • Created a dedicated key for this tool (not reusing one).
  • Pasted it into the tool’s secure field, not a screenshot or shared file.
  • Set a usage or spending limit if the service allows it.
  • Confirmed I can revoke this key without breaking other tools.
  • Noted where the key is so I can rotate it later.

It’s a two-minute routine that turns API keys from a quiet liability into a controlled, reversible grant of access. For the bigger picture on protecting yourself when using AI, our guide to AI safety and privacy basics is a good next read.

What to do if a key leaks

Even careful people slip up, so it’s worth knowing the recovery steps. They’re simple and fast:

  1. Revoke the exposed key immediately. Go to the service’s dashboard and delete or disable it. The moment a key is revoked, it stops working — anyone holding it now has a useless string.
  2. Generate a replacement. Create a fresh key and update the tools that were using the old one.
  3. Check your usage. Look at recent activity for anything you don’t recognize. If the leak ran up unexpected usage, this is where you’ll see it, and many providers will work with you on genuinely fraudulent charges.
  4. Figure out how it leaked so it doesn’t happen again — remove it from the repo, the screenshot, or wherever it surfaced.

The key thing to remember is that a leaked key is only dangerous while it’s still valid. Revoking it is the fix, and it takes seconds. The worst outcome comes from not noticing a leak, which is exactly why glancing at your usage now and then is worth the habit.

The bottom line

An API key is a password for software — the credential a tool uses to access a service like an AI model on your behalf, billed to your account. That makes it both useful and worth guarding. Keep keys out of public places, give each tool its own, set limits where you can, and revoke anything that leaks.

Handle keys with the same care you’d give a password and a credit card, because in effect a key is a little of both. Do that, and you can connect AI to as many tools as you like without losing sleep over your bill or your data.

Join the Internet 101 newsletter for more practical guides on using AI tools safely.

#api keys#security#apis#ai tools#integrations

Liked this guide? Get the next one free.

One practical email on AI and the modern internet — new explainers, tool picks, and how-tos. No hype, no spam.

Join curious builders learning AI the practical way. No spam, ever.

Keep reading