# Backup Retention Policy

Cloudback allows you to set up a backup retention policy for your repositories. The retention policy defines how long the backups should be kept before they are automatically deleted. Retention policies apply to all supported platforms.

## How Retention Works

A retention policy has two enforcement dimensions that both apply to every backup definition:

* **Age limit**: backups older than the configured number of days are deleted.
* **Count limit**: when the number of successful backups exceeds the configured maximum, the oldest backups are removed first.

Both limits are checked independently. A backup is removed if it violates either limit.

### Deduplication protection

Backups that serve as a deduplication parent (referenced by one or more newer backups) are **never deleted**, even if they exceed the configured limits. This ensures that backups referencing a parent archive always remain valid.

### Enforcement timing

Retention is enforced **hourly** by a background maintenance job. Changing a retention policy does not delete backups immediately - the change takes effect at the next hourly enforcement pass.

## Available Retention Presets

Cloudback includes the following built-in retention policies, available to all accounts:

| Policy        | Age Limit | Count Limit  |
| ------------- | --------- | ------------ |
| Last 30 days  | 30 days   | 200 backups  |
| Last 90 days  | 90 days   | 270 backups  |
| Last 180 days | 180 days  | 540 backups  |
| Last 360 days | 360 days  | 1080 backups |

The default policy for new accounts and new repositories is **Last 30 days**.

## Setting Up a Backup Retention Policy

Follow these steps to set a retention policy for a repository:

1. Go to the [Cloudback Dashboard](https://app.cloudback.it/).
2. Open the repository details page for the repository you want to configure.
3. In the **Settings** section, locate the `Retention` combo box and choose the retention policy you want to apply to the repository:

![Backup retention policy](https://2781059148-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQEI7SjBF2CddqNXZpCoE%2Fuploads%2Fgit-blob-efba6cd3626f663d73309c2ac6dd13270bbe815a%2Fbackup-retention-policy.png?alt=media)

4. Click the **Save** button to save the changes.

You can update the retention policy for multiple repositories at once using [Bulk Operations](https://docs.cloudback.it/managing-backups/bulk-operations).

## Custom Retention Policies

If the built-in presets don't cover your use case, you can request a **custom retention policy** with specific age and count limits.

Custom retention policies can't be created from the UI. To request one, [contact the Cloudback support team](https://docs.cloudback.it/troubleshooting-and-support/contact-us) at <support@cloudback.it> with your desired age limit (in days) and count limit. Custom policies are usually set up within one business day.

Once created, your custom retention policy will appear in the **Retention** dropdown alongside the built-in presets - both in the repository settings and in [Account Settings](https://docs.cloudback.it/managing-backups/account-settings). The support team can also restrict a custom policy to specific platform accounts.

## Account-Level Default Retention

The **Account Settings** page lets you configure a default retention policy that is applied automatically to all new repositories added to your account. Changing the account-level default does not affect repositories that already have a retention policy assigned - use [Bulk Operations](https://docs.cloudback.it/managing-backups/bulk-operations) to update existing repositories.

## Learn More

* [Account Settings](https://docs.cloudback.it/managing-backups/account-settings)
* [Bulk Operations](https://docs.cloudback.it/managing-backups/bulk-operations)
* [Contact Us](https://docs.cloudback.it/troubleshooting-and-support/contact-us)
