A Perplexity API key lets whoever holds it call Perplexity’s Sonar models and search API as your account, with the usage billed to you. It does not open your Perplexity chat history and it does not reach your servers. The risk is spending: someone else’s requests, paid by your credits or card. The key carries no user identity and no second factor, so there is nothing to stop a stranger who finds it. Replace it, revoke the old one, then look at how much it was used.
Check your GitHub account for leaked secrets — free
- Provider
- Perplexity
- Severity
- High
- Impact
- SaaS account access and billing
- Checked live by LeakWatch
- No
What a Perplexity API key looks like
A Perplexity key starts with pplx-, followed by 48 letters and digits:
pplx-…XXXX Perplexity API key (masked, 48 characters after the prefix)
The prefix is specific to Perplexity, which makes this one easy to recognise and to search for. Your own copy sits in a variable such as PERPLEXITY_API_KEY or PPLX_API_KEY, next to a call to api.perplexity.ai. Perplexity’s API is compatible with OpenAI-style client libraries, so a leaked key often appears in code that looks like an OpenAI call with a different base URL. Do not confuse it with the Perplexity web app login: the key and your account password are separate things.
How Perplexity API keys get leaked
- Hardcoded in a script. A quick search or chat call with the key inline, committed as it is.
- Environment files.
.envfiles, Docker compose files and notebook configs copied into a repository. - Agent and tool configs. Research agents, search plugins and MCP configuration files that store the key in plain text, then land in a public dotfiles repository.
- Browser code. A key placed in front-end JavaScript so that a web page can call the API directly, where every visitor can read it.
- Tutorials and shared notebooks. A key pasted in a Colab notebook, a gist, an issue or a screenshot.
What to do in the first hour
- Create a new key first. In the Perplexity API console, open the API Keys page of your project and generate a new key. Perplexity shows the full key once, so copy it straight into your secret store.
- Deploy the new key to every application that used the old one, and check with a test request that it works.
- Revoke the exposed key. Perplexity’s documentation says revocation is permanent: once a key is revoked it cannot be recovered. Do it in the console from the same API Keys page, or with a
POSTto the/revoke_auth_tokenendpoint, passing the key to revoke. Do this after step 2 so your application is not down in between, but do not leave it for later. - Check usage. Open your usage and billing pages for the period since the exposure. Look for requests you cannot explain, and for models or search features you do not use.
- Check your credits and payment settings. Compare the credit balance with your last known level. If you have auto top-up or a card on file, set a low limit until you have finished reviewing.
- Look for other keys in the same place. A repository that held a Perplexity key often holds other providers’ keys in the same file. Rotate each of them at its own provider.
- Move the key out of the code. Read it from an environment variable or a secret manager, call the API from a backend rather than from the browser, and remove the old value from the repository. See I accidentally pushed an API key to GitHub.
Not sure what else leaked from the same repository? Run a free scan.
Revoke it at Perplexity
Perplexity keys are managed from the API console, under your project’s API Keys page, after you sign in with the account that created the key. Revoking a key there, or through the /revoke_auth_token endpoint described in Perplexity’s API key management guide, stops it from working. Because revocation cannot be undone, create and deploy the replacement first. If you cannot find the key, you are probably signed in to the wrong account or project, or it is not a Perplexity key. Console labels can change, so if the wording differs from this guide, look for the section where keys are created and listed.
How LeakWatch detects it
The rule is called Perplexity API Key. It matches pplx- followed by exactly 48 letters and digits, followed by a quote, a space, a line end or a similar boundary, with the severity set to high. This type is not checked live: LeakWatch has no validator for it, so it can tell you that a key of the right shape is exposed, but not whether it still works. Assume it does until you have revoked it.
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 read my Perplexity searches with this key?
No. The API key makes requests as your API account. It does not open the history of the web app. What it exposes is your credits and the ability to run requests as you.
I revoked the key. Can I get it back if I made a mistake?
No, revocation is permanent. That is why the order matters: create the new key, deploy it, then revoke the old one.
The key was only in a private repository. Should I still replace it?
Yes, if the repository has collaborators, forks or CI logs, or if you are not sure who can read it. Replacing a key is cheap, and a key you doubt is worth less than a new one.