# Leaked SparkPost API Key? Delete It, Audit Sending

> SparkPost API key exposed on GitHub? Delete it, create a narrower one and check sent mail and suppression lists. Step-by-step guide.

Source: https://leakwatch.net/secrets/sparkpost-api-key

---

[LeakWatch](/)

[Product](/product)[Live feed](/leaks)[Guides](/secrets)[Blog](/blog)[Free scan](/)

1.  [Home](/)
2.  [Secrets](/secrets)
3.  SparkPost API Key

Messaging · Secret guide

# Leaked SparkPost API Key: what to do in the first hour

High severityDetected onlyLast verified October 30, 2026 · 4 min read

A SparkPost API key lets whoever holds it call the SparkPost email API with the permissions chosen when the key was created. Many keys are created with every permission selected, because SparkPost’s own guidance says that is acceptable when you are unsure. In that case a stranger can send mail as your verified sending domains, read and change suppression lists, and read account information. Spam or phishing sent from your domain damages its reputation for weeks. Delete the key first, then investigate what it did.

[Check your GitHub account for leaked secrets — free](/)

Provider

SparkPost

Severity

High

Impact

SaaS account access and billing

Checked live by LeakWatch

No

## What a SparkPost API key looks like

A SparkPost key is a 40-character string made of upper and lower case letters and digits. It has no vendor prefix, so the string alone proves nothing:

```text
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX   SparkPost API key (masked, 40 letters and digits)
```

The key is sent in the `Authorization` header of requests to the SparkPost API, and it also serves as the SMTP password when you relay through SparkPost. Typical variable names are `SPARKPOST_API_KEY` and `SPARKPOST_SMTP_PASSWORD`. Accounts on the US platform and on the EU platform are separate, so a key only works on the platform where it was created. After creation the console shows only the key name, its permissions and its first four characters, which helps you match a leaked value to the right entry.

## How SparkPost API keys get leaked

-   **Hardcoded in a mailer script.** A quick test of the transmissions endpoint with the key typed into the code and committed.
-   **Environment files.** `SPARKPOST_API_KEY` in a `.env` or compose file that ends up in a repository.
-   **SMTP configuration.** The key reused as the SMTP password in framework mail settings, so it appears in a config file as well as in the environment.
-   **Plugins and CMS settings.** Newsletter and form plugins that store the key in a settings export or a database dump that gets shared.
-   **CI logs and support threads.** A debug step that prints the Authorization header, or a request pasted in a ticket.

## What to do in the first hour

1.  **Open the API keys list** in your SparkPost account (see the link below) and identify the exposed key by its name and first four characters.
2.  **Create a replacement key** with only the permissions the application needs, for example sending only. A narrow key limits the next leak.
3.  **Deploy the new key** to your application or secret store and send one test message.
4.  **Delete the exposed key** from the list. Retry a request with the old value to confirm it is rejected with an authorization error.
5.  **Review what was sent.** Look at the message events and reports in the SparkPost console for the period since the exposure: unknown recipients, unexpected volume, spikes in bounces or spam complaints.
6.  **Check what the key could change.** Review sending domains, suppression lists, templates and webhooks. Remove entries you do not recognize, in particular a webhook pointing to a URL you do not own.
7.  **Clean up the code.** Remove the key from the repository and from its history, and rotate neighbouring secrets in the same file. See [I accidentally pushed an API key to GitHub](/blog/i-accidentally-pushed-an-api-key-to-github).

Not sure what else leaked from the same repository? [Run a free scan](/).

[Not sure what else leaked? Run a free scan.](/)

## Revoke it at SparkPost

SparkPost keys are managed from the API keys page of your SparkPost account, after you sign in on the platform (US or EU) that owns the key. Select the exposed key and delete it; third-party guides describe the deletion as immediate. A person has not confirmed the exact menu wording for this guide, and SparkPost’s product is now part of Bird, so the interface may differ. Look for the page where keys are created and listed, and follow the current SparkPost documentation.

## How LeakWatch detects it

The rule is called SparkPost API Key. It looks for the word `sparkpost` (any case), then up to 40 characters of anything, then exactly 40 letters and digits with word boundaries on each side. So the key must appear close to the vendor name, in a variable name, a URL or a comment. A bare 40-character string with no `sparkpost` nearby is not reported, and neither is a longer or shorter string. The severity is **high**.

This type is not checked live: LeakWatch has no validator for SparkPost keys, so a finding means the pattern was seen, not that the key still works. Test it yourself by deleting it in the console.

LeakWatch detects this format but does **not** check it live: it can tell you the key is exposed, not whether it still works. Assume it does until you have revoked it.

## FAQ

Can a SparkPost key send mail from my domain?

Yes, if its permissions include sending and the domain is verified on the account. That is why the key should be deleted before anything else.

Does deleting the key stop mail already queued?

Deleting the key blocks new API calls with it. Review the message events afterwards to see what was accepted before the deletion, and contact SparkPost support if you see abuse.

The key was in a private repository. Do I still rotate it?

Yes if the repository was ever public, or if collaborators, forks or CI logs could read it. When in doubt, replace it, since it costs a few minutes.

## Related

-   [SendGrid API Key](/secrets/sendgrid-api-key)
-   [Mailgun API Key](/secrets/mailgun-api-key)
-   [Postmark Server Token](/secrets/postmark-server-token)
-   [I accidentally pushed an API key to GitHub](/blog/i-accidentally-pushed-an-api-key-to-github)
-   [Which vendors leak most this week](/leaks/trends)
-   [All secret guides](/secrets)

[Get alerted next time a secret leaks — create a free account](/)

LeakWatch is not affiliated with SparkPost.

![Gabriel Diyan, founder of LeakWatch](/brand/Photo-Gabriel-Diyan.webp)

Gabriel Diyan (0xCr0c0)

Cybersecurity student, founder of LeakWatch. I built and run the scanner described here — the detection patterns, the false-positive classifier and the provider validators are mine. [More about who I am](/about).

[GitHub](https://github.com/Leakwatch-Scan) · [X](https://x.com/LeakwatchScan) · [LinkedIn](https://www.linkedin.com/in/gabriel-diyan-80a378375) · [GitHub (personal)](https://github.com/crocogab)

LeakWatch

Secrets leak into public commits every minute. This watches the forges for yours. Built and run by [Gabriel Diyan](/about), a cybersecurity student — [why LeakWatch exists](/about).

Scan

-   [Product](/product)
-   [Live feed](/leaks)
-   [Trends](/leaks/trends)
-   [API docs](/docs)
-   [CI/CD](/docs?tab=ci)

Read

-   [Blog](/blog)
-   [Secret guides](/secrets)
-   [Changelog](/changelog)
-   [About](/about)

Verify

-   [Security](/security)
-   [Privacy](/privacy)
-   [Terms](/terms)
-   [Legal](/legal)
-   [Contact](/contact)
-   [Status](https://status.leakwatch.net)

© 2026 LeakWatch

[GitHub](https://github.com/Leakwatch-Scan)[X](https://x.com/LeakwatchScan)
