Keys / LangSmith

LANGSMITH_API_KEY

The LangSmith key your app sends traces and calls the LangSmith API with: a personal access token, service key or tracing key.

Starts with
lsv2_
Expires
you choose, or never
API
create, list and delete personal access tokens, service keys and tracing keys

Get it

Create one on smith.langchain.com/settings. The steps aren't recorded yet.

Set it

LANGSMITH_API_KEY=lsv2_...

The LangSmith Python and JS SDKs read it from this variable when you don't pass a key. If it isn't set, they read LANGCHAIN_API_KEY. Or keep it out of .env with keypin: keypin run -- npm run dev

Replace it

  1. Create a new key of the same type. Give a service key the same workspaces and role; give a tracing key the same workspaces.
  2. Deploy it everywhere that reads LANGSMITH_API_KEY.
  3. Check that traces arrive with the new key, then delete the old one. It stops working within a minute.

Set rotate_every on the key in keypin.toml and a rotated date on its vault item, and keypin status shows when it's due.

Sources, checked 2026-11-16