SK… / Auth Token
Exposed Twilio API Key / Auth Token? Here's how to detect and rotate it
Twilio key or Auth Token in your code? Rotate it in the Console, then set geo limits and usage alerts. Clear steps and a free Trust scan to check your repo.
Twilio requests are authorized with either your Account SID plus Auth Token, or an API Key (SID starting with SK) and its secret. Both can send SMS, make calls, and read your logs, all billed to your account. If either leaks, an attacker can rack up charges and pull your data until you rotate it in the Console.
What an attacker can do with a leaked Twilio API Key / Auth Token
- Sends SMS and places voice calls on your account, and toll fraud to premium international numbers can cost thousands fast.
- Reads your message and call logs - phone numbers, message bodies, and recordings - leaking your users' data.
- Buys phone numbers and changes messaging config, entrenching access and adding more to your bill.
- Drains your balance and can get your account flagged or suspended for the fraudulent traffic.
How Twilio API Key / Auth Tokens get exposed
- Committed to a public repo - the Account SID and Auth Token pair often sit together in a .env.
- Hardcoded in a mobile app or client-side bundle instead of staying on your server.
- Pasted into a screenshot, support ticket, or chat while debugging SMS or voice.
- Logged in plaintext in server logs or an HTTP request trace.
Scan your repo for exposed Twilio API Key / Auth Tokens - free
Trust checks the files in your repo and the JavaScript your site ships. No signup, results in about a minute.
Run a free scan →How to rotate a leaked Twilio API Key / Auth Token
- Sign in at console.twilio.com and open Account → Keys & Credentials → API keys & tokens.
- If the Auth Token leaked, create a Secondary Auth Token, update your app to use it, then click ‘Promote to Primary’ - this deletes the old token and rejects it immediately.
- If an API Key (SK…) leaked, open it under API keys, click ‘Delete this API Key,’ and confirm - requests using it stop working at once.
- Create a fresh API Key if you deleted one, copy its secret once, and store it in your secrets manager.
- Update your server environment with the new credential and redeploy, then remove the Account SID + Auth Token from anywhere it was hardcoded.
- Check Monitor → Logs → Messaging and Voice, plus Usage, for SMS, calls, or number purchases you didn't make, and open a Twilio support ticket if you see fraud.
Open the Twilio API Key / Auth Token dashboard →
Account SID, API Key, Auth Token: which is secret?
- Account SID (starts with AC): an ID. On its own it does not give access.
- Auth Token: the master password for the account. Keep it server-side only.
- API Key (SID starts with SK) and its secret: safer for apps. You can make one per app and delete one without touching the rest.
Set two guard rails today
- Geographic permissions: in the Console, switch off countries you never call or text, so calls and texts to those places are refused.
- Usage triggers or alerts: get an email when daily spend passes a number you choose.
- Both take a few minutes and also help if a key ever leaks.
How Trust helps
Trust's repo scan looks for Twilio API Key IDs (the SK format) in your files. Run it before you push, and again after you rotate.
Other secret types to check
- Database Connection Stringpostgres:// (mysql/mongodb/redis://)
- Private Key (RSA / SSH / EC)-----BEGIN … PRIVATE KEY-----
- JWT Signing SecretHS256 signing secret
- AWS Access KeyAKIA…
- Stripe Secret Keysk_live_…
- OpenAI API Keysk-…