# My Twilio key leaked. What do I do?

**Short answer:** For a leaked Auth Token, request a secondary token in Console, update every app, then promote it to primary, which immediately invalidates the old token. For a leaked API key (SID starting `SK`), delete it and create a new one. Then check usage for SMS pumping or calls you didn't make. Twilio credentials can rack up telecom charges fast.

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

## Is it this key?

**Format:** Account SID `AC…` (an identifier, not a secret) plus a 32-character Auth Token. API key SIDs start with `SK` and come with a secret.

**Blast radius:** The Auth Token gives full account access: send SMS and make calls on your bill, read message logs, buy numbers. An API key's reach depends on its type.

## The first 10 minutes

| When | Do | How |
|---|---|---|
| 0–3 min | Auth Token | Console → account settings → API keys & tokens → Auth Tokens → request a secondary token. |
| 3–6 min | Swap | Update every app and subaccount to the new token, then Promote to primary. The old token stops working immediately. |
| 6–8 min | API keys | Delete any leaked `SK…` API key and create a replacement. |
| 8–10 min | Check usage | Review Usage, Messaging and Voice logs for unknown traffic, especially international SMS. Set geo-permissions and usage triggers. |

## 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

### Is the Account SID secret?
No, it identifies the account. The Auth Token and API key secrets are the credentials.

### Why not just promote immediately?
Promotion kills the old token at once, so update apps first unless it's actively being abused.

### Can I use Twilio from the browser?
Only via short-lived Access Tokens minted by your server, never the Auth Token.

## Sources

- [Twilio: Incident response for credential exposure](https://www.twilio.com/docs/usage/api-security-reference-guide/incident-response)
- [Twilio: Secondary Auth Token](https://www.twilio.com/docs/iam/api/secondary_authtoken)
- [Twilio: API keys](https://www.twilio.com/docs/iam/api-keys)

## Related

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