---
title: "Retention policy | Customer&#x27;s Canvas Hub"
canonical: "https://customerscanvas.com/docs/hub/dev-center/concepts/retention-policy/"
---

# Retention policy

> Every time a user saves a design or uploads a picture, it is saved in BackOffice in the private user's storage. However, we do not need to store every single order, as some orders may be abandoned during personalization sessions. To avoid accumulating unnecessary data, a retention policy has been implemented.

The data in your tenant is divided into two categories:

- _Permanent_. This asset category uses a _"Never"_ policy, and the assets will be permanently stored in the system. You can manually delete them if needed.
- _Temporary_. This category uses a _"Default"_ policy, and the assets are stored according to your account's retention settings, for example, for 30 days.

There is also a special _"Unknown"_ policy value used for older data created before this policy was introduced, which disables cleanup, but it's not recommended to use this directly.

According to the default retention policy in BackOffice, a background task is performed on the server once a day, which finds and deletes outdated resources for all clients with automatic cleanup enabled.

To set up a retention policy through the UI, log in to your tenant, navigate to **Settings** > **Storage**, change the policy values for **Temporary data** and **Projects data**, and click **Save**. To perform the cleaning immediately, click **Clear data now**.

![Retention policy settings.](images/storage-settings.png)

Now let's look at how you can configure the policy through the API.

## Setting up the retention period

When creating a tenant, you can enable automatic cleanup and define a retention period in the endpoint [`POST ​/api​/storage​/v1​/tenants`](https://customerscanvas.com/docs/hub/dev-center/api/asset-storage.md#tag/tenants/Create).

```
POST ​/api​/storage​/v1​/tenants
{
  "id": 0,
  "settings": {
    "enableAssetsRetention": true,
    "assetsRetentionPeriodInDays": 0
  },
  "name": "string",
  "customFields": {}
}
```

The default value of `AssetsRetentionPeriodInDays` is `60` days. If `AssetsRetentionPeriodInDays` is `0`, no cleanup will be performed for the tenant.

When `EnableAssetsRetention` is set to `true`, the tenant will be involved in the cleanup, and its assets will be considered outdated if both of the following conditions are met:

- `RetentionPolicy` is set to `Default`.
- `LastAccessTime` is earlier than the `AssetsRetentionPeriodInDays` defined in the tenant settings.

## Which objects can have a policy set

Public assets are never deleted automatically. You can apply your retention policy to private assets only:

- [Private Designs](https://customerscanvas.com/docs/hub/dev-center/api/asset-storage.md#tag/privatedesigns)
- [Private Images](https://customerscanvas.com/docs/hub/dev-center/api/asset-storage.md#tag/privateimages)
- [Private Mockups](https://customerscanvas.com/docs/hub/dev-center/api/asset-storage.md#tag/privatemockups)
- [Private Resources](https://customerscanvas.com/docs/hub/dev-center/api/asset-storage.md#tag/privateresources)

## Setting up a policy for single objects

When creating an asset, the policy value can be set to:

- `"Unknown"`
- `"Never"`
- `"Default"`

For example, you can make a private design permanent by changing its retention policy to `Never` using the endpoint [`POST /api/storage/v1/private-designs/{id}/retention-policy`](https://customerscanvas.com/docs/hub/dev-center/api/asset-storage.md#tag/privatedesigns/SetRetentionPolicy).

```
POST /api/storage/v1/private-designs/{id}/retention-policy[?policy&tenantId&ownerId]
{
    "policy": "Never"
}
```

## Finding out the current policy for an object

You can get the policy value for an asset by its ID. For example, for private designs, use the endpoint [`GET /api/storage/v1/private-designs/{id}/retention-policy`](https://customerscanvas.com/docs/hub/dev-center/api/asset-storage.md#tag/privatedesigns/GetRetentionPolicy).

```
GET /api/storage/v1/private-designs/{id}/retention-policy
```

As a result, this endpoint returns either `"Unknown"`, `"Never"`, or `"Default"`.

## Deleting objects manually

Once a day, a background task that finds and deletes outdated assets for all tenants with `EnableAssetsRetention` set to `true` is performed on the backend. At the same time, you can manually trigger the cleanup through the endpoint [`POST /api/storage/v1/tenants/{id}/clean-up`](https://customerscanvas.com/docs/hub/dev-center/api/asset-storage.md#tag/tenants/CleanUp).

```
POST ​/api​/storage​/v1​/tenants​/{id}​/clean-up
```

## Storing projects

Projects and project data have a separate storage time setting. By default, their policy value is _Never_, and they are not cleaned up automatically.

When cleanup througn [`/api/storage/v1/tenants/{id}/clean-up`](https://customerscanvas.com/docs/hub/dev-center/api/asset-storage.md#tag/tenants/CleanUp) or the **Clear data now** button occurs, both the design and rendering artifacts are deleted, along with the project.

Since a design copy is created when you create a project, you can safely delete the original design after creating the project.
