Retention policy
- 3 minutes to read
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 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.
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 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
set to true
, the tenant will be involved in the cleanup, and its assets will be considered outdated if the following conditions are met:
RetentionPolicy
is set toDefault
.LastAccessTime
is earlier than theAssetsRetentionPeriodInDays
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:
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 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 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 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 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.