Skip to content

Leaked Perplexity API key? What to do now

Revoke it first, then check what it was used for, cap what your keys can spend and clean up where it leaked. Every Perplexity step below comes from Perplexity's own docs, checked 17 Nov 2026.

Free. No sign-up.

Whose key leaked?
Where did it leak?

What to do now, for Perplexity

  1. Revoke the key now

    Create a new key on the API keys page, then revoke the leaked one with the /revoke_auth_token endpoint, calling it with the new key. A revoked key can't be recovered. Perplexity's docs only describe revoking through the API. Do this first: until it's revoked, anyone who copied it can keep spending. GitHub alerts the repo's owner about Perplexity keys, and its push protection can block them, but it doesn't report them to Perplexity, and Perplexity's docs don't say it disables leaked keys.

    Perplexity API keys

  2. Keep the new key on the server

    Put the new key only in a server-side secret: your host's environment settings, your builder's secrets, or Supabase function secrets. Never in a variable starting NEXT_PUBLIC_, VITE_ or EXPO_PUBLIC_, which are sent to every visitor.

    Lovable secretsBolt secretsSupabase function secrets

  3. Check usage for charges that weren't yours

    On the Billing page, admins can filter usage analytics by API key. Members can't see usage. Note the time the key leaked and the time you revoked it.

    Perplexity billing

  4. Cap what any key can spend

    Perplexity is prepaid: once credits run out, your API keys are blocked until you add more, unless auto reload is on. Perplexity's docs describe no spend limit setting, so keep the balance small.

    Perplexity billing

  5. Clean up the repo, after revoking

    Remove the key from the code and the git history, but only once it's revoked: anyone who cloned the repo, or a fork, still has it. Then turn on push protection, so GitHub blocks the next key you try to push.

    GitHub: removing sensitive dataGitHub: push protection

  6. If someone ran up charges, ask for them back

    Email api@perplexity.ai. Perplexity's API terms treat all use of your API keys as your own use, and say payments are non-refundable. Say when the key leaked, when you revoked it and which usage wasn't yours.

    api@perplexity.ai

Checked in Perplexity's own docs. Sources: API key management, projects, FAQ, API terms of service. Dashboards move, so if a link is out of date, look for the same setting under account or organisation settings.

Then find every other copy, with your coding agent

Find every place an API key or other secret is exposed in this project, and fix it. Search the code, env files, config and local settings files (such as .claude/settings.local.json), the full git history (with gitleaks or a similar scanner) and the built browser bundle. Flag any secret in a variable with a public prefix such as NEXT_PUBLIC_, VITE_ or EXPO_PUBLIC_, and any AI provider called from browser code. Move every AI call into a server route or function that reads its key from a server-only variable, add .env and local settings files to .gitignore, and list each key that was exposed and where, so I can revoke it. Don't rewrite git history.

Questions

Does Perplexity disable a leaked key for you?

GitHub alerts the repo's owner about Perplexity keys, and its push protection can block them, but it doesn't report them to Perplexity, and Perplexity's docs don't say it disables leaked keys. Revoke it yourself either way.

Can I cap what a Perplexity key spends?

Perplexity is prepaid: once credits run out, your API keys are blocked until you add more, unless auto reload is on. Perplexity's docs describe no spend limit setting, so keep the balance small.

How do I see what a leaked Perplexity key was used for?

On the Billing page, admins can filter usage analytics by API key. Members can't see usage.

Will Perplexity refund charges from a leaked key?

Email api@perplexity.ai. Perplexity's API terms treat all use of your API keys as your own use, and say payments are non-refundable.

How do I find where my Perplexity key leaked?

Search your code, your git history and your live site's JavaScript for “pplx-” (how Perplexity keys start). Common places are browser code, a committed .env or local settings file, and screenshots.

Other providers