Data retention
LangSmith provides automatic data retention capabilities to help with compliance and storage management. Data retention policies can be configured at the organization and project levels. For detailed information about data retention configuration and management, please refer to the Data Retention concepts documentation.Customize extended retention policy
This feature is available for Enterprise plan customers. For self-hosted Enterprise customers, refer to the workspace-level configuration section.
Configure extended retention
In the LangSmith UI:- Navigate to Settings at the bottom of the page.
- Select Usage configuration from the left-hand menu.
- Find the workspace in the list that you would like to configure.
- Click on the value under the Data retention policy column for that workspace.
- On the workspace usage configurations modal, customize the extended policy using the dropdown for Extended - All traces are retained for option.
- Select Save.
Workspace-level extended retention for self-hosted
Self-hosted Enterprise customers can also use workspace-level extended retention configuration instead of system-wide TTL settings. This provides more granular control over data retention for different workspaces without requiring environment variable changes. To configure this for self-hosted deployments, refer to the self-hosted TTL documentation for the legacy system-wide approach or contact support.Trace deletes
You can use the API to complete trace deletes. The API supports two methods for deleting traces:- By trace IDs and session ID: Delete specific traces by providing a list of trace IDs and their corresponding session ID (up to 1000 traces per request)
- By metadata: Delete traces across a workspace that match any of the specified metadata key-value pairs
Deletion timeline
Trace deletions are processed during non-peak usage times and are not instant. LangChain runs the delete job on the weekend. There is no confirmation of deletion - you’ll need to query the data again to verify it has been removed.Delete specific traces
To delete specific traces by their trace IDs from a single session:The
session_id is the project ID for the trace you are trying to delete. You can find it on the tracing project page in the LangSmith UI.Delete by metadata
When deleting by metadata:- Accepts a
metadataobject of key/value pairs. KV pair matching uses an or condition. A trace will match if it has any of the key-value pairs specified in metadata (not all) - You don’t need to specify a session id when deleting by metadata. Deletes will apply across the workspace.
user_id: "user123" or environment: "staging" in their metadata.
Example deletes
You can delete dataset examples self-serve via our API, which supports both soft and hard deletion methods depending on your data retention needs.Deleting examples is a two-step process
For bulk operations, example deletion follows a two-step process:1. Search for examples by metadata
Find all examples with matching metadata across all datasets in a workspace. GET /examplesas_ofmust be explicitly specified as a timestamp. Only examples created before theas_ofdate will be returned
user_id: "user123" or environment: "staging" in their metadata across all datasets in your workspace.
2. Hard delete examples
Once you have the example IDs, send a delete request. This will zero-out the inputs, outputs, and metadata from all versions of the dataset for that example. POST /v1/platform/datasets/examples/delete/- Specify
example_ids(list of example IDs) andhard_delete(boolean) in the request body
Deletion types
Soft delete (default)
- Creates tombstoned entries with NULL inputs/outputs in the dataset
- Preserves historical data and maintains dataset versioning
- Only affects the current version of the dataset
Hard delete
- Permanently removes inputs, outputs, and metadata from ALL dataset versions
- Complete data removal when compliance requires zero-out across all versions
- Set
"hard_delete": truein the request body
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

