There's a Twilio API key in your website's code. Delete it before someone runs up your bill.
Last reviewed November 13, 2026 against the providers' current documentation.
The short version
In the Twilio Console, open Settings → Account settings → API keys & auth tokens, click the key whose SID matches the SK… value we found, and choose Delete this key. Twilio's fraud guide says apps using a deleted key stop working immediately, so create a new key for your server first if it needs one. Then check Monitor → Logs → Messaging and Calls for traffic you didn't send, turn off Geo permissions for countries you don't serve, and move the Twilio calls your page made into server code that reads the new key from a server-only environment variable.
Why it matters
Twilio authenticates API requests with HTTP Basic auth: the API key SID (SK followed by 32 hex characters) as the username and the key's secret as the password. The SID on its own isn't enough to make calls, but a page that ships the SID almost always ships the secret next to it, because the code needed both to work. With both, anyone can do what the key allows: a Standard key reaches every Twilio API resource except Accounts and Keys, and a Main key is, in Twilio's words, "equivalent to using your Account SID and Auth Token". That means sending SMS and placing calls billed to you. Twilio's own fraud guide shows what attackers do with such access: bursts of outbound messages and calls to expensive international numbers (SMS pumping and toll fraud), new API keys created for later, and changed webhook URLs on your phone numbers. A key works until you delete it.
Fix it, in this order
Find the key and its secret
Search your code and build settings for theSK…value. It usually sits in aVITE_TWILIO_API_KEY,NEXT_PUBLIC_TWILIO_API_KEYorREACT_APP_variable, with the secret in a matching…_API_SECRETvariable and often your Account SID (AC…) too. Also check whether your Auth Token is in the same files; our check doesn't look for Auth Tokens, and if it's there, rotate it as well (see the FAQ). If the page uses Twilio Voice, Video, Conversations or Sync in the browser, the secret may be there to create Access Tokens on the client, which Twilio's docs say you create on your server.Delete the key
In the Twilio Console go to Settings → Account settings → API keys & auth tokens, open the API keys tab, click the key (match the SID), click Delete this key and confirm. Twilio's docs say deleting an API key revokes its authorization to the REST API and also invalidates Access Tokens created with its secret, and that apps using it stop working immediately. If your own server uses the same key, create a new key first and swap it in. The secret of a new key is shown only when you create it, so copy it straight into your server's secret store.Check what the key did
Twilio's fraud response guide lists where to look. Monitor → Logs → Messaging: filter by the dates the key was public and look for a jump inoutbound-apimessages, especially to countries you don't serve, or bodies with links you didn't write. Monitor → Logs → Calls: unknown internationalTonumbers or unusually long calls. Monitor → Insights → Audit → Audit Events Log:account-api-keys.created(a new key the attacker can keep using; delete it) andphone_number.updated(webhook or TwiML changes). Twilio notes the console doesn't show every Monitor event; the CLI commandtwilio api:monitor:v1:events:listdoes. If you find fraud, tell Twilio Support.Limit the damage next time
Under Messaging → Settings → Geo permissions and Voice → Settings → Geo permissions (and Verify, if you use it), uncheck every country you don't do business in; Twilio's guide calls Geo Permission block errors (21215 for SMS, 13227 for Voice) direct proof of blocked toll fraud. Turn on SMS Pumping Protection under Messaging → Settings; Twilio says it's free for the US and Canada and priced per country elsewhere. For the new key, prefer a Restricted key with only the permissions your server uses (Twilio creates these through the Key resource v1 API) over a Standard or Main key.Move Twilio calls to a server
The browser should never hold a Twilio secret. Put each call behind a small server endpoint (an API route, a Server Action, a Supabase Edge Function, a Cloudflare Worker, a Twilio Function) that reads the key from a server-only environment variable. Don't let the page choose any phone number and message: an OTP or "text me a link" form is exactly the phone-number field SMS pumping abuses, so rate-limit by IP and number, add a CAPTCHA, and only send to countries you serve. For Voice, Video, Conversations or Sync in the browser, have the server mint short-lived Access Tokens (Twilio's maximum is 24 hours; use the shortest that works) for the signed-in user.Clean up the old copies
Remove the key and secret from your.envfiles and source, rebuild and deploy, then run the check again. Old builds stay in browser caches, CDN caches and web archives, which is why deleting the key comes first.
Or ask your AI tool to do it
Paste this into Lovable, Bolt, Cursor, Claude Code or whichever tool built your app. Review what it changes before you deploy.
My website's frontend JavaScript contains a Twilio API key SID (it starts with SK) and probably its secret. Find every place a Twilio credential is defined or read, including .env files and any VITE_, NEXT_PUBLIC_, REACT_APP_ or EXPO_PUBLIC_ variable: API key SID and secret, Account SID (AC...) and Auth Token. Find every place that uses the Twilio SDK or calls api.twilio.com, verify.twilio.com or other Twilio APIs, and list what each call does. Remove every Twilio secret from client-side code and move each call into a server-side endpoint (API route, server action, Supabase Edge Function or serverless function) that reads the credentials from server-only environment variables. The endpoint must not let the browser pick an arbitrary phone number and message body: validate the number, only allow the countries we serve, rate-limit by IP and by phone number, and add a CAPTCHA to public forms that send SMS or start calls. If the page uses Twilio Voice, Video, Conversations or Sync, add a server endpoint that creates a short-lived Access Token for the signed-in user instead. Finally, remind me to delete the old API key in the Twilio Console and create a new one for the server.
How this happens
Usually a phone login, "text me the app" link, appointment reminder or click-to-call button that an AI coding tool wired up from the page. The Twilio SDK needs credentials, so the tool puts the API key and secret in VITE_ or NEXT_PUBLIC_ variables to get rid of an undefined error, and that copies them into the JavaScript every visitor downloads. Even if the browser call fails, the credentials are still sitting in the bundle.
Check that it's really fixed
After you deploy, run the free check. It reads your live site the way an attacker would and tells you if any secret key is still visible.
Topic check: Exposed API key checker
Find the other leaks before someone else does
The free check reads your home page and its scripts. The website security report goes through up to 30 pages and 40 JavaScript files, plus .env and .git files, security headers, cookies and CORS, domain and email records, and libraries with known vulnerabilities. Every finding comes with the fix for your host and a prompt for your AI tool.
$19 once, including 20 runs over 30 days so you can fix things and check again.

Questions
Is the SK value alone dangerous?
On its own, no: Twilio needs the API key SID and its secret together. But the code that put the SID in your page almost always needs the secret too, so search your bundle and source for it. Delete the key either way: it costs you a few minutes, and you can't prove the secret wasn't shipped in an older build.
What if my Auth Token is in the code too?
Rotate it. In API keys & tokens → Auth Tokens, request a secondary token, update your servers to use it, then Promote to primary; Twilio says promoting deletes the old primary token so calls using it fail. Subaccounts have their own Auth Tokens, so repeat it for any subaccount whose token leaked.
Will Twilio stop the fraud for me?
Don't count on it. SMS Pumping Protection and Geo permissions block some fraud, but a valid key still sends whatever its owner's account allows. Twilio's security FAQ says never to include your token, API key or secret in your code, and the first step of its incident response is to revoke or rotate the credential in the Console.
Can I make a Twilio key safe to use in the browser?
No. Anything in your JavaScript can be copied. Twilio's client SDKs (Voice, Video, Conversations, Sync) are built around short-lived Access Tokens that your server creates with the API key secret, which Twilio says should only be known to your application and Twilio.
Does your check try the key?
No. The free check is passive: it finds SK followed by 32 hex characters in your page and its JavaScript, shows it cut short, and never sends it to Twilio. A long hex string that starts with SK can occasionally be something else; if it isn't a Twilio key, you can ignore the finding.
Sources
- Twilio: Create API keys in the Console (key types, delete a key)
- Twilio REST API: Key resource v1 (SID format, secret shown once, delete)
- Twilio: Twilio API requests (API key SID and secret in Basic auth)
- Twilio fraud response guide: Contain (delete keys, rotate Auth Token, Geo permissions)
- Twilio fraud response guide: Analyze (Messaging, Call and Audit logs)
- Twilio: SMS Pumping Protection for Programmable Messaging
- Twilio: Access Tokens (client SDKs, created on your server)
- Twilio: FAQ about API security