> For the complete documentation index, see [llms.txt](https://docs.middle.app/middle-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.middle.app/middle-docs/product/data-deletion.md).

# Data deletion

Automate the deletion of stored data you no longer need

Data deletion can be set on the instance level, for ENTERPRISE customers, and on the record-type level for INTEGRATE customers.

## Data types

There are three data types, as it pertains to data deletion:

* **Records:** This is Middle-ingested data via syncs. A record will be deleted when its "last purposeful use" date exceeds the number of days you set for data retention. A record's "last purposeful use" date is refreshed every time that record is referenced in a workflow execution or trigger execution and every time that record is updated. The date of last purposeful use and expected deletion date for each record can be viewed when reviewing records in the app connection.

{% hint style="info" %}
While deleting a record is permanent, the record can be retrieved again by running an ad-hoc sync if the source app still provides it
{% endhint %}

* **Record history:** Whenever Middle sees an updated record, it stores a copy of the old version of that record. This is used to assist in troubleshooting when looking at a record and its history in Middle and for tracking record changes. The date of deletion for this record type is based on the date the update was synced by Middle.
* **Script execution history:** Whenever Middle executes a workflow or a sync function, it stores a detailed history of the execution. This data is helpful for troubleshooting integration issues. These records are deleted according to the history retention period.

## Instance-wide data deletion

ENTERPRISE customers can configure instance-wide data deletion under **More → Settings** at the top of the Middle application.

By default, all instances, including the INTEGRATE instance, are set up to delete records after 30 days since their last purposeful use. Record history and execution history are kept for the current calendar month and one full prior month.

## Record retention overrides

For all Middle customers instance-wide record retention rules can be overridden within an account's app connection.

To configure a deletion override follow the below steps:

1. Go to the account
2. Click on the connection you want to set the override in
3. Next to the record type click **Data retention overrides**
4. You have the option to either disable all data deletion for that record type or you can set the number of days records will be retained without a workflow or trigger referencing the record
5. Click **Save**


---

# 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.middle.app/middle-docs/product/data-deletion.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.
