Back

API Key Sharing: What It Means (and What To Do About It)

When one API key shows up from many IPs, it’s often a leak. Here’s how to interpret it, avoid false alarms, and respond fast.

API keys are supposed to identify one client or integration. When the same key suddenly appears from many different IP addresses, it’s a strong signal that the key is being shared, copied into a public client, or outright leaked.

This is one of the most common (and most expensive) failure modes for API products: the key keeps working, usage ramps up quietly, and you only notice when bills, abuse, or user complaints show up.

What “API key sharing” usually means

There are a few common explanations, and not all of them are malicious:

  • Leaked key: the key was committed to a public repo, pasted into a ticket, or exposed in logs.
  • Client-side key: the key is embedded in a frontend/mobile app where anyone can extract it.
  • Team-sharing: multiple developers use the same key across machines and networks.
  • Resellers / “friends”: the key is intentionally shared with third parties.
  • Proxy/NAT effects: the opposite problem also exists — many users can share one IP. But seeing many different IPs for one key is still a red flag.

Why it matters

  • Cost: shared keys can drive usage way beyond what you priced for.
  • Security: a leaked key can be used to scrape data, brute force endpoints, or enumerate resources.
  • Support load: abuse looks like “your API is slow/broken” to real customers.
  • Trust: customers expect you to catch compromised credentials quickly.

How to interpret the alert (without overreacting)

A good rule is to consider two things:

  • How many unique IPs used the key recently.
  • Whether those IPs are “active” (not just one-off hits).

One key showing up from 6–10 IPs over a few days can happen organically (travel, VPN, office + home + mobile). The risk increases when:

  • Unique IPs keep climbing day over day.
  • Multiple IPs have sustained usage (not just a single request).
  • Usage patterns look automated (high request rate, consistent intervals, repetitive paths).

What to do right now (quick response checklist)

  1. Confirm ownership: is this key tied to a specific customer/project? If yes, notify them.
  2. Rotate the key: generate a new key and revoke the old one (or set a short grace period).
  3. Check for obvious leaks: public repos, CI logs, pastebins, shared Slack messages, support tickets.
  4. Contain blast radius: add rate limits, tighten quotas, or restrict sensitive endpoints until you’re confident.
  5. Track recurrence: if it happens again, the key is likely still being distributed (or embedded in a client).

Long-term fixes that prevent sharing

Rotating keys fixes the symptom. These patterns fix the cause:

  • Never ship keys in public clients: keep API keys server-side. Frontends should use short-lived tokens from your backend.
  • Use per-user or per-install keys: one leaked key should affect one user, not everyone.
  • Prefer short-lived credentials: expiring tokens and refresh flows reduce damage from leaks.
  • Add allowlists when it makes sense: IP allowlists work for server-to-server integrations (not for mobile users).
  • Separate environments: don’t reuse production keys in staging, demos, or test apps.
  • Make rotation easy: if customers can’t rotate quickly, they won’t.

Common false positives (and how to handle them)

  • VPNs: a developer’s VPN can make their IP “move” often. Look for sustained usage across many IPs.
  • Distributed workers: some customers legitimately run from multiple regions. Encourage one key per worker / per region.
  • Corporate networks: many users behind one IP is normal — but that’s the inverse pattern (not many IPs for one key).
  • Short spikes: a one-time burst from a few IPs might be a test. If unique IPs keep growing, treat it as real.

The goal: catch leaks early

Most teams discover leaked keys late. The best time to act is when it’s still just a handful of IPs — before it becomes a full-blown abuse incident.

If you can detect “one key, many IPs” early, you can usually fix it with a simple conversation and a key rotation instead of an incident response.

FAQ

Isn’t it normal for one key to be used from multiple IPs?
Sometimes, yes (home + office + mobile, travel, VPNs). The risk signal is when the number of unique IPs keeps increasing and multiple IPs show sustained activity.
Should I block by IP to prevent sharing?
IP allowlists are great for server-to-server customers, but they’re usually a bad fit for mobile and consumer apps. In those cases, use short-lived tokens and per-user keys instead.

Related

Why a Dedicated Alerting App Is Better Than a “Platform”