# My Replicate key leaked. What do I do?

**Short answer:** Disable the token at replicate.com/account/api-tokens, create a new one stored only on your server, and review recent predictions and billing for runs you didn't start. Anyone with the token can run models billed to your account, including expensive GPU models. Replicate also scans public GitHub repos, auto-disables tokens it finds and emails you.

*Last updated 2026-11-25 · Reviewed by ProofForge*

## Is it this key?

**Format:** `r8_` (40 characters)

**Blast radius:** Run any model as you (billed to you), and read your predictions, models and deployments.

## The first 10 minutes

| When | Do | How |
|---|---|---|
| 0–2 min | Disable | replicate.com/account/api-tokens → click Disable next to the leaked token. |
| 2–4 min | Replace | Create a new token and set `REPLICATE_API_TOKEN` on the server. Redeploy. |
| 4–8 min | Check runs | Review the predictions dashboard and billing for unknown runs. |
| 8–10 min | Close the hole | Remove the token from client code and git history, and route calls through your backend. |

## Stop the next leak

- Keep the key in a server-side env var. Never use a `VITE_`, `NEXT_PUBLIC_` or `EXPO_PUBLIC_` variable or hard-code it in frontend code.
- Call the provider from your backend or an edge function, and add `.env*` to `.gitignore`.
- Re-scan the live site after every deploy. Keys also leak through JS bundles, source maps and exposed `.env` or `.git` paths.

> **Scan box (use the site's ScanBox component):** Check whether your live app has this problem. Paste your URL for a free outside-in scan covering exposed keys, open database rules, CORS and security headers. [Scan my app free →](https://proofforge.live/#scan)

## FAQ

### Can I call Replicate from the browser?
Not with your token. Proxy requests through your server.

### Will Replicate catch leaks?
It scans public GitHub repos and auto-disables tokens it finds. Leaks elsewhere, like your site's JavaScript, are on you.

### Do old predictions disappear?
No. Rotating doesn't delete history.

## Sources

- [Replicate: API tokens](https://replicate.com/docs/topics/security/api-tokens)
- [Replicate: HTTP API](https://replicate.com/docs/reference/http)

## Related

- [Fix: secrets in VITE_ / NEXT_PUBLIC_ vars](/fix/vite-env-secrets)
- [Fix: .env file exposed](/fix/env-file-exposed)
- [Exposed API key checker](/tools/exposed-api-key-checker)
- [Fix: source maps exposed](/fix/source-maps-exposed)
- [All leaked-key guides](/leaked-keys)
