How can we manage and configure data retention policies?

Last updated: January 12, 2026

Prerequisites

Plans: Any

Deployments: Any

Use case

Managing storage costs and complying with data privacy regulations within the Control Plane and the API.

Features used

Using the project level automation settings we can apply a data retention policy to project logs, experiments, and datasets.

Steps

Control Plane

Step 1: Open the project you would like to configure a data retention policy for.

Step 2: Click Configure Project in the top right corner of the dashboard.

Step 3: Select Data Management from the left hand navigation menu.

Step 4: Click Create Automation.

  • This will open a configuration form.

Step 5: Select "Data retention" from the Type dropdown menu.

Step 6: Select your Retention target.

  • "Logs", "Experiments", or "Datasets".

Step 7: Enter your Retention period in days.

Step 8: Click Create automation in the bottom right corner.

Retention policies set for a target apply to all instances of that target within the project.

API

Below is an example curl request that creates a data retention policy of 1 year for project logs.

curl --request POST \
  --url https://api.braintrust.dev/v1/project_automation \
  --header 'Authorization: Bearer sk-your-api-key' \
  --header 'Content-Type: application/json' \
  --data '
{
  "project_id": "f2a658f4-d478-450f-9b01-a8995a6e9132",
  "name": "Retain logs for 1 year",
  "config": {
    "event_type": "retention",
    "object_type": "project_logs",
    "retention_days": 365
  },
  "description": "This data retention policy will remove any logs older than a year."
}
'

API Endpoint Documentation