Skip to content

My SendGrid key leaked. What do I do?

Short answer

Delete the key under Settings → API Keys in SendGrid, create a Restricted Access key with only Mail Send on your server, and check Activity for mail you didn't send. Leaked SendGrid keys are widely abused for spam and phishing, which can get your account suspended.

Last updated 2026-11-25 · Reviewed by ProofForge

Is it this key?

Format: SG.

Blast radius: Full-access keys can send mail, read contacts, and change settings and other keys. Restricted keys only reach what they allow.

The first 10 minutes

WhenDoHow
0–2 minDeleteSettings → API Keys → delete the leaked key.
2–4 minReplaceCreate a Restricted Access key (Mail Send only) and set it server-side. Redeploy.
4–8 minCheck activityReview Activity and stats for unexpected volume. Check for new API keys, users or sender identities.
8–10 minClose the holeRemove the key from code and git history, and turn on 2FA if it isn't on.

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.

Check your live app

A free, read-only public-surface scan. It cannot diagnose private sessions or every cause described above.

Read-only. No writes or row contents.

FAQ

Is SendGrid part of Twilio?

Yes. Its docs live on twilio.com/docs/sendgrid.

Can I edit a key to remove permissions instead of deleting it?

Delete a leaked key. Editing permissions doesn't stop the holder from sending with what's left.

Was my contact list exposed?

If the key had Marketing or full access, assume so.

Sources

Related

Read as Markdown · Scan methodology