SG.…

Exposed SendGrid API Key? Here's how to detect and rotate it

A leaked SendGrid key (SG.…) lets attackers blast spam from your verified domain and tank your deliverability. Scan free with Trust, then delete the key in Settings.

A SendGrid API key (starting with SG.) authenticates requests to SendGrid's Mail Send API and can send email as your account. Anyone who has it can push mail through your verified sending domain and IPs. SendGrid shows the key only once at creation, so if it leaks you can't retrieve it — you have to delete it and make a new one.

What an attacker can do with a leaked SendGrid API Key

How SendGrid API Keys get exposed

Scan your repo and live site for exposed SendGrid API Keys — free

Trust checks your code, git history, and shipped JavaScript. No signup, results in about a minute.

Run a free scan →

How to rotate a leaked SendGrid API Key

  1. Go to app.sendgrid.com/settings/api_keys and sign in.
  2. Find the leaked key, click the action menu (three dots) in its row, and select Delete — SendGrid rejects it immediately after.
  3. Click ‘Create API Key,’ give it Restricted Access with only the scopes you need (usually just Mail Send), and copy it once.
  4. Update your server environment or secrets manager with the new key and redeploy.
  5. Rotate any other credentials that sat next to it, since a leaked repo or log usually exposes more than one.
  6. Open the Email Activity feed at app.sendgrid.com/email_activity and check Stats for sends you didn't make, then report abuse to SendGrid if you see spam going out.

Open the SendGrid API Key dashboard →

Other secret types to check

Keep your app safe