API keys
LangSmith supports two types of API keys. You can use both types of token to authenticate requests to the LangSmith API, but they have different use cases:- Personal Access Tokens (PATs) inherit the permissions of the user who created them. Use PATs for personal scripts or tools.
- Service keys can be scoped to specific workspaces or the entire organization. Use service keys for applications and production services.
Create an API key
To log traces and run evaluations with LangSmith, you will need to create an API key to authenticate your requests. To create either type of API key:- Navigate to the Settings page and select the API Keys section.
- For service keys, choose between an organization-scoped and workspace-scoped key. If the key is workspace-scoped, you must specify the workspaces. Enterprise users can also assign specific workspace roles to service keys, which adjusts their permissions independently of any user.
- Set the key’s expiration; the key will become unusable after the number of days chosen, or never, if that is selected.
- Click Create API Key.
LangSmith will display the API key only once, so make sure to copy it and store it in a safe place.
Delete an API key
To delete an API key:- Navigate to the Settings page and scroll to the API Keys section.
- Find the API key you need to delete from the table. Toggle Personal or Service as needed.
- Select the trash icon in the Actions column and confirm deletion.
Configure the SDK
You may set the following environment variables in addition toLANGSMITH_API_KEY.
This is only required if using the EU instance.
LANGSMITH_ENDPOINT=https://eu.api.smith.langchain.com
This is only required for keys scoped to more than one workspace.
LANGSMITH_WORKSPACE_ID=<Workspace ID>
Using API keys outside of the SDK
See instructions for managing your organization via API.Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

