Skip to content
AI · Secret guide

Leaked LangSmith Personal Access Token: what to do in the first hour

High severityDetected onlyLast verified · 5 min read

A LangSmith personal access token is the credential that a developer uses to call the LangSmith API, the tracing and evaluation service from LangChain. It acts as a user of your LangSmith workspace, so whoever holds it can read traces, which often contain prompts, model outputs, tool inputs and the user data that passed through your application. It can also change datasets, projects and settings, depending on the role of the user who created it. Traces are the part people underestimate: they can hold far more sensitive text than the code that produced them. Delete the token first, then review what it could read.

Check your GitHub account for leaked secrets — free

Provider
LangChain
Severity
High
Impact
SaaS account access and billing
Checked live by LeakWatch
No

What a LangSmith Personal Access Token looks like

LangSmith personal access tokens start with lsv2_pt_, followed by a block of hexadecimal characters, an underscore and a shorter block of hexadecimal characters:

lsv2_pt_…XXXX_…XXXX   LangSmith personal access token (masked)

The lsv2_pt_ prefix marks a personal token. LangSmith also issues service keys and project-level keys, which use other prefixes and are managed separately, and they should be treated with the same care. A token found in a file usually sits in a variable such as LANGSMITH_API_KEY, which the LangChain and LangSmith SDKs read automatically when they start. That convenience is also why the value is so often pasted into a .env file and then into a repository.

A personal token carries the permissions of the user who created it, so a token created by an administrator is more sensitive than one created by a read-only analyst. Check the role of the account that owns the leaked token before you decide how wide the review should be.

How LangSmith Personal Access Tokens get leaked

  • Environment files. A .env file that holds the tracing variables, pushed to a public repository along with the rest of the application.
  • Notebooks. A key set in a notebook cell to turn on tracing, then saved with the notebook and shared with colleagues or posted online.
  • Deployment configuration. A container or serverless setting that writes the token into a file in the image, instead of reading it from a secret store.
  • Shared traces. A trace or dataset export that includes configuration values, sent to a support ticket or posted in a discussion.
  • Build logs. A test run that prints the environment or the SDK configuration, which ends up in a CI log that many people can read.

What to do in the first hour

  1. Delete the token. Open the Settings page in LangSmith, find the token in the API keys section and use the trash icon in its row to delete it. Do this before you clean the code, so the leaked value stops working at once.
  2. Review traces and projects. Look at the projects, datasets and traces in the period since the token may have been exposed. Check for unknown projects, exports you did not start, and deleted runs.
  3. Check the members of the workspace. Make sure the people listed still need access, and remove anyone who does not.
  4. Create a replacement with the smallest role the job needs. Store it in your secret manager or in the deployment’s secret settings, not in a file.
  5. Look at the data that was traced. If the leaked token gave access to traces, consider whether those traces contained customer data or internal documents, and handle them according to your own policy.
  6. Clean the code. Remove the value from the files, and switch the application to read the variable from its environment. See I accidentally pushed an API key to GitHub.

Not sure what else leaked from the same project? Run a free scan.

Not sure what else leaked? Run a free scan.

Revoke it at LangChain

LangSmith lists its API keys on the Settings page, in the API keys section. Locate the key you need to remove and select the trash icon in the Actions column. The LangChain documentation for deleting API keys is at docs.langchain.com. The documentation also says the key value is shown only once, so copy the new value when you create it. The exact menu wording and the endpoint for personal tokens were not fully confirmed for this guide, so follow the layout you see in your workspace.

How LeakWatch detects it

The rule is called “LangSmith Personal Access Token”. It looks for the prefix lsv2_pt_, followed by thirty-two hexadecimal characters, an underscore and ten more hexadecimal characters, with word boundaries on both sides. A token with a different structure, or one that has been cut short, is not reported. The severity is high, with the impact class for SaaS data. This type is not checked live: LeakWatch does not call LangSmith with the token 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

Is a LangSmith token the same as an OpenAI or Anthropic key?

No. It is a credential for the LangSmith tracing service, not for a model provider. A leaked LangSmith token does not give access to your model accounts, but the traces it can read may still contain the outputs and inputs that passed through those models.

What can a leaked token expose?

It can expose whatever the owner of the token could see: traces, prompts, outputs, datasets and the configuration of the projects. Check the role of the token’s owner, because that sets the boundary of the exposure.

Will deleting the token break my tracing?

Yes, until the application has the new value. Deploy the replacement, confirm that a test run appears in the project, and then make sure the old token is gone.

Get alerted next time a secret leaks — create a free account

LeakWatch is not affiliated with LangChain.