> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/guides-and-quickstarts/organization-administration/data-retention.md).

# Data retention

Data retention policies control how long StackAI keeps supported records. Set a policy for each data type that must be removed after a defined period.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FTscJEfAr3qjqxJhodUog%2FG100.mp4?alt=media&token=28f306a1-8603-4cc7-9c5a-6a594c814a7d>" %}

## Before you start

Ask the data owner to approve which record types and retention periods should apply before enabling deletion. Record the existing settings and confirm that older records are no longer needed for investigation or review. Use [Audit logs](https://docs.stackai.com/guides-and-quickstarts/organization-administration/audit-logs.md) and [Inspect project analytics](https://docs.stackai.com/guides-and-quickstarts/evaluations-and-observability/inspect-project-analytics.md) to locate relevant records before shortening a retention period.

You need permission to manage retention and an agreed retention period for each data type.

## Review and enable a retention policy

Open Settings → Data Retention and inspect the available policy cards.

![Retention policy cards](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/fTJhFPaIIt31PBIxNhpK/assets/g100-g100-01-cards.png)

Review each entity's enabled state and retention period separately.

Read the enablement confirmation and its permanent-deletion consequence.

![Permanent-deletion enablement confirmation](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/0ZQEUFD87keCeAd6eKAg/assets/g100-g100-02-confirm.png)

Enable a policy only when that deletion behavior matches the organization's requirements.

## Set the retention period

Choose the required interval under Retain for.

![Retain for interval](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/uQLh5kGPvyTM9MDZfIS7/assets/g100-g100-03-period.png)

A shorter interval can make older records eligible for deletion.

After saving, confirm the policy's enabled state and period.

![Saved policy state and period](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/gRZFK4Z86Ad1zjr0JSoT/assets/g100-g100-04-saved.png)

A configuration success message does not prove that background deletion has already occurred.

## Review all active policies

Review the final retention settings for all relevant entities.

![Active retention policies by entity](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/P0vDZA4Of3c1K8fLdblW/assets/g100-g100-05-final.png)

Increasing the period later does not recover records that have already been deleted.

## Important behavior

Retention deletion is permanent. Increasing the retention period later does not restore deleted records.

A saved policy confirms the configuration. Background deletion may occur later.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/guides-and-quickstarts/organization-administration/data-retention.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
