A Klaviyo private API key lets whoever holds it call Klaviyo’s API as your account, within the scopes that were chosen when the key was created. Those scopes can cover reading customer profiles, changing lists and segments, sending events, and managing campaigns and flows. Customer profiles are personal data, and flows that send email run under your brand, so a leaked key harms your customers as well as your account. Delete the exposed key first, then create a scoped replacement and check what the old one did.
Check your GitHub account for leaked secrets — free
- Provider
- Klaviyo
- Severity
- High
- Impact
- SaaS account access and billing
- Checked live by LeakWatch
- No
What a Klaviyo API key looks like
Klaviyo private keys begin with pk_, followed by a body of hexadecimal characters. LeakWatch looks for the two forms that Klaviyo uses for private keys: pk_ followed by 34 lowercase hexadecimal characters, or pk_ followed by six letters or digits, an underscore, and then the same 34 hexadecimal characters. Masked, the first form looks like this:
pk_…XXXX Klaviyo private API key (masked)
Do not confuse a private key with a public key. Klaviyo’s public identifiers are short and are designed to appear in browser code, for example in a sign-up widget or a tracking script, so they do not grant access to your account. A private key is a secret, and it is the one this guide covers. If you find both in the same file, the private key is the one to replace, and the public identifier can stay where it is.
How Klaviyo API keys get leaked
- Server code with the key written in. An integration that sends events or syncs profiles, committed with the private key in the source instead of an environment variable.
- Environment files. A
.envfile or deployment file that holds the key next to other secrets, and was never excluded from version control. - Shopify, WordPress and other plugin settings. Exported configuration files or a copied settings page that includes the key.
- Front-end code. A private key placed in browser code by mistake, which ships it to every visitor. Only public identifiers belong in the browser.
- Logs and support threads. A debug log that records the request headers, pasted into an issue or a chat thread to ask about an error.
What to do in the first hour
- Create a replacement key first. In your Klaviyo account, open Settings, then API keys, and create a new private key. Choose the narrowest scope the integration needs rather than full access. Save the value straight into your secret manager, because Klaviyo does not show a key again after it is created.
- Deploy the new key. Update the integration or the application, restart it if needed, and make one read call and one event call. Confirm both succeed and that the test event appears in the right account view.
- Delete the exposed key. On the same API keys page, delete the old key. Deletion is permanent, and calls with the old value fail from then on. Klaviyo’s guidance is to delete the exposed key and create a separate key for each integration that used it.
- Check what the key did. Look at the activity for the period since the exposure. Check for profile exports, bulk list changes, new segments or flows you did not build, and events from unfamiliar sources. Look at the sending activity too, because a new campaign or a flow with a changed template is an easy way to send phishing that looks legitimate.
- Review your flows and campaigns. Open the flows and campaigns that were edited or created recently. Pause anything you did not expect, and check the links and sender details in active templates.
- Review users and other keys. Check which users can manage API keys and which other keys exist. Delete any key that nobody can name an owner for, and remember that only certain account roles can create or delete private keys, so the owner may need to do this step.
- Clean the repository. Remove the value from the code and, if you want the old copy gone from history, rewrite it. See I accidentally pushed an API key to GitHub.
Not sure what else leaked? Run a free scan.
Revoke it at Klaviyo
Private API keys are managed in your account under Settings, then API keys. Find the key by its name and delete it. If the integration still needs access, use the clone option, which creates a replacement with the same scopes, and then delete the old key once nothing uses it. You can also disable a key and re-enable it later, which pauses the integrations and workflows that depend on it. Disabling is a useful step if you need to stop the key right away while you work out what depends on it, but it leaves the value valid for re-enabling, so delete the key once you are sure.
Only the account roles that are allowed to manage API keys can create, clone, disable or delete them, so if the page is missing or read-only for you, ask an owner or an admin to make the change. Klaviyo does not let you view a private key after it is created and does not let you change its scopes later, which is why the replacement key must be created with the scopes you want. The API keys page of your account is the place to start.
How LeakWatch detects it
The rule is called “Klaviyo API Key”. It looks for the literal prefix pk_, then either exactly 34 lowercase hexadecimal characters, or six letters or digits followed by an underscore and the same 34 hexadecimal characters. The value must have a word boundary on both sides. The fixed prefix and the fixed length make false positives uncommon, and short public identifiers without the long hexadecimal body are not reported. The severity is high, and the impact class is software-as-a-service, because the key controls customer data and sending in your account. This type is not checked live: LeakWatch does not send any request to Klaviyo with the key it finds.
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 someone see my customer list with this key?
Only if the key’s scopes allow reading profiles or exporting lists. Scopes are chosen when a key is created, and a read-only key cannot change anything, but a full-access key can. You cannot change the scopes of an existing key, so look at the key’s details in your account, then assume it could read everything the scopes allowed until the activity review shows otherwise.
Does the public identifier have to be replaced too?
No. A public identifier is designed to be visible in browser code, and it does not let anyone act on your account. Replace the private key, and leave the public identifier alone unless the leak showed that someone is using it for something it was not meant for.
Will deleting the key stop my flows and sends?
Only the integrations that call the API with that key. Most flows and campaigns are set up inside Klaviyo and do not depend on the API key, but any service that calls the API with it will fail. Create the replacement and deploy it first, then delete the old key, so the interruption is short.