> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skyfree.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Retention

> Automatically delete your platform's old automation logs and archived messages after a set number of days.

## What is this?

The **Data Retention** tab (page heading **Data retention for your platform**) lets you choose how long your platform's own old data is kept before it is deleted automatically. You can set a window for automation webhook triggers, automation step logs, automation runs, and archived messages. The cleanup runs daily, and you can also preview or run it yourself. Deleted data cannot be recovered.

\[SCREENSHOT: platform-settings-data-retention-overview — The Data Retention tab in Platform Settings showing the four policies, each with a switch, a Keep for (days) field, and the Instance limit line]

<Info>
  Viewing this tab needs the `platform:view` permission, and saving, previewing, or running a cleanup needs `platform:edit`. You can only choose a window equal to or shorter than the limit set by the instance owner — never a longer one.
</Info>

## What can I do here?

* Turn each policy on or off and set its **Keep for (days)** window
* See the **Instance limit** (the longest window allowed) next to each policy
* See when the last cleanup ran, and how many rows each policy deleted
* Click **Preview** to see how many rows would be deleted, without deleting anything
* Click **Run now** to delete expired data immediately
* Click **Save changes** to store your settings

## How to use it

### The policies

| Policy | What it covers | Default window | Minimum |
| - | - | - | - |
| **Automation webhook triggers** | Raw payloads received by automation webhook triggers | 30 days | 7 days |
| **Automation step logs** | Per-step input and output of finished automation runs. Running automations are never touched | 30 days | 7 days |
| **Automation runs** | Finished automation run records and their step logs. Running automations are never touched | 30 days | 7 days |
| **Archived messages** | Messages already moved to the archive after 90 days, together with their stored media files (images, videos, audio, documents) in your storage bucket | 730 days | 180 days |

Other logs (such as user activity logs and contact activity logs) are managed only by the instance owner.

### Set a retention window

<Steps>
  <Step title="Open the tab">
    Go to **Platform Settings** and open the **Data Retention** tab.
  </Step>

  <Step title="Turn on a policy">
    Switch the policy on, then enter the number of days in **Keep for (days)**. The field is disabled while the policy is off. Under it you see either "Between N and N days" (when the instance owner has the same policy on) or "Minimum N days", and, when the instance has the policy on, "Instance limit: N days".
  </Step>

  <Step title="Save">
    Click **Save changes** (enabled only after you change something). The toast says "Data retention settings saved". If a value is above the instance limit, it is lowered to the limit when saved.
  </Step>
</Steps>

### Preview and run a cleanup

1. Save your changes first — **Preview** and **Run now** stay disabled while you have unsaved changes, and also while no policy is turned on.
2. Click **Preview**. Under each policy you see "Preview: N rows would be deleted". Nothing is deleted.
3. Click **Run now**. In the **Delete expired data now?** dialog, read "Every enabled policy will permanently delete your platform's data older than its retention window. This cannot be undone." and click **Delete now**.
4. A toast says "Cleanup finished: N rows deleted", and each policy shows "Last run deleted N rows".

### Archived messages

**Archived messages** is marked "Customer data. Deleted rows and files cannot be recovered." Only messages that have already been moved to the archive are affected — live messages and conversations are never deleted by retention. When you switch it on and click **Save changes**, an **Enable deletion of archived messages?** dialog asks you to confirm. Use **Preview** first, then click **Enable and save**.

## Troubleshooting / Technical Notes

* **Preview and Run now are greyed out.** Click **Save changes** first, and make sure at least one policy is turned on.
* **I can't enter more than a certain number of days.** The instance owner has set a limit for that policy. The **Instance limit** line shows it, and the **Keep for (days)** field accepts values from the minimum up to that limit.
* **My window was lowered after saving.** If the instance owner shortens their window, yours is capped to the new limit.
* **"Could not save data retention settings", "Could not preview data retention", or "Could not run data retention".** Read the message shown under the title. If it says a retention run is already in progress, wait for it to finish and try again.
* **"Could not load data retention settings."** Reload the page. You need the `platform:view` permission to see this tab.
* **Nothing was deleted.** Check that the policy's switch is on and that the instance owner has not switched off automatic deletion for the instance.

## Related docs

* [Platform Settings](/platform/platform-settings)
* [Data Retention (instance)](/self-host/whitelabel-setup/data-retention)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.