Lite scheduled cleanup
BAF Lite provides the ability to clean up data — both on a scheduled basis and manually for a specific date. As a result, both the attempts themselves (endeavors) and their associated biometric data are deleted.
Cleanup works per aggregation and is configured independently for each. This means that different aggregations can have different cleanup schedules. Each attempt is created within a specific aggregation. In BAF Lite, the aggregation with the identifier `28608d66-a571-44ec-94db-04a00143ff51` is used.
Manual cleanup allows you to delete all data created before a specified point in time, which is set when calling the procedure. Scheduled cleanup allows you to configure automatic data deletion according to a schedule, triggered at specific intervals (for example, at the end of a quarter, month, week, etc.).
For more details on how to configure cleanup procedures, see the cleanup configuration section.
API for cleanup settings
Cleanup settings contain the data used to perform cleanups. These settings are the input identifier for all operations related to data cleanup for a specific aggregation.
Settings are created for an aggregation and use its ID. For configuring BAF Lite, the following aggregation must be used: 28608d66-a571-44ec-94db-04a00143ff51.
Creating a Cleanup Settings object
This request creates a cleanup settings object for the specified aggregation. Only one active settings object can exist per aggregation.
Request schema:
POST /lrs/settings?aggregate_entity=<aggregate_id>
Example request
curl -X 'POST' \
'http://192.168.10.1/lrs/settings?aggregate_entity=28608d66-a571-44ec-94db-04a00143ff51' \
-H 'accept: application/json' \
-H 'token: token' \
-H 'Content-Type: application/json' \
-d '{
"retention_settings": {
"enable": true,
"content_retention": 1,
"content_retention_dimension": "days",
"execution_cron": "* 1 1 * *"
}
}'
Query parameters
| Parameter | Description |
|---|---|
aggregate_entity | Identifier of the aggregation for which the cleanup settings are being created. Required. |
Request headers
| Header | Description |
|---|---|
token | Token of the video-recorder service. Stored in the video-recorder-token secret in the ./cfg/video-recorder.secrets.json file. Required. |
Request body parameters (application/json)
The request body must contain a retention_settings object with the following fields:
| Field | Description |
|---|---|
enable | Enables or disables scheduled cleanup. Type: bool. Required. |
content_retention | Data retention period expressed in the units specified in content_retention_dimension. Data created earlier than (scheduled cleanup start time - content_retention) will be deleted. Type: int. Required. |
content_retention_dimension | Unit of measurement for the retention period. Allowed values: "seconds", "minutes", "hours", "days", "weeks". Required. |
execution_cron | Schedule for running the cleanup procedure in cron format (e.g., * 1 1 * * — every 1st day of the month at 1:00). Type: string. Required. |
Example request body
{
"retention_settings": {
"enable": true,
"content_retention": 1,
"content_retention_dimension": "days",
"execution_cron": "* 1 1 * *"
}
}
Updating a Cleanup Settings object
This request updates an existing cleanup settings object for the specified aggregation.
Request schema:
PUT /lrs/settings?aggregate_entity=<aggregate_id>
Example request
curl -X 'PUT' \
'http://192.168.10.1/lrs/settings?aggregate_entity=28608d66-a571-44ec-94db-04a00143ff51' \
-H 'accept: application/json' \
-H 'token: token' \
-H 'Content-Type: application/json' \
-d '{
"retention_settings": {
"enable": true,
"content_retention": 1,
"content_retention_dimension": "days",
"execution_cron": "* 1 1 * *"
}
}'
Query parameters
| Parameter | Description |
|---|---|
aggregate_entity | Identifier of the aggregation whose settings are being updated. Required. |
Request headers
| Header | Description |
|---|---|
token | Token of the video-recorder service. Stored in the video-recorder-token secret in the ./cfg/video-recorder.secrets.json file. Required. |
Request body parameters (application/json)
The request body contains a retention_settings object with the following fields:
| Field | Description |
|---|---|
enable | Enables or disables scheduled cleanup. Type: bool. Required. |
content_retention | Data retention period expressed in the units specified in content_retention_dimension. Data created earlier than (scheduled cleanup start time - content_retention) will be deleted. Type: int. Required. |
content_retention_dimension | Unit of measurement for the retention period. Allowed values: "seconds", "minutes", "hours", "days", "weeks". Required. |
execution_cron | Schedule for running the cleanup procedure in cron format (e.g., * 1 1 * * — every 1st day of the month at 1:00). Type: string. Required. |
Example request body
{
"retention_settings": {
"enable": true,
"content_retention": 1,
"content_retention_dimension": "days",
"execution_cron": "* 1 1 * *"
}
}
Retrieving a Cleanup Settings object
This request returns previously created cleanup settings for the specified aggregation.
Request schema:
GET /lrs/settings?aggregate_entity=<aggregate_id>
Example request
curl -X 'GET' \
'http://192.168.10.1/lrs/settings?aggregate_entity=28608d66-a571-44ec-94db-04a00143ff51' \
-H 'accept: application/json' \
-H 'token: token'
Query parameters
| Parameter | Description |
|---|---|
aggregate_entity | Identifier of the aggregation for which the cleanup settings are requested. Required. |
Request headers
| Header | Description |
|---|---|
token | Token of the video-recorder service. Stored in the video-recorder-token secret in the ./cfg/video-recorder.secrets.json file. Required. |
Example response
On successful execution, a 200 OK status is returned along with the cleanup settings object:
{
"retention_settings": {
"enable": true,
"content_retention": 1,
"content_retention_dimension": "days",
"execution_cron": "* 1 1 * *"
}
}
API for manual cleanup and cleanup results
Retrieving cleanup results
This request returns the results of the last executed cleanup for all aggregations for which settings have been created. The results include the cleanup status and the date relative to which it was performed. If cleanup is currently running, the status will reflect that state.
Request schema:
GET /lrs/retention/metrics
Example request
curl -X 'GET' \
'http://192.168.10.1/lrs/retention/metrics' \
-H 'accept: application/json' \
-H 'token: token'
Request headers
| Header | Description |
|---|---|
token | Token of the video-recorder service. Stored in the video-recorder-token secret in the ./cfg/video-recorder.secrets.json file. Required. |
Example response
On successful execution, a 200 OK status is returned and an object where the key is the aggregation ID and the value is the cleanup result object:
{
"28608d66-a571-44ec-94db-04a00143ff51": {
"result": {
"exception": null
},
"status": 1,
"planned_retention_date": "2026-06-29T11:10:15.843710+00:00",
"actual_retention_date": "2026-06-29T10:56:00+00:00",
"last_modified": "2026-06-29T11:10:15.843715+00:00"
}
}
Response structure
| Field | Description |
|---|---|
result | Object containing information about the cleanup result. Currently contains the exception field with error details, if any occurred. |
status | Cleanup status. Possible values: 0 — cleanup is currently running; 1 — cleanup completed successfully; 2 — an error occurred during cleanup. |
planned_retention_date | Scheduled time of the previous cleanup run (according to the schedule). |
actual_retention_date | Actual date relative to which the cleanup was performed. All attempts created before this date were deleted. |
last_modified | Last modification time of the cleanup result record. |
Retrieving the next scheduled cleanup time
This request returns the date and time of the next scheduled cleanup run for the specified aggregation.
To obtain the next scheduled cleanup time for a newly created settings object, you must wait for the first run of the internal schedule check procedure. For more details, see the cleanup configuration section.
Request schema:
GET /lrs/retention/retention_time/<aggregate_id>
Example request
curl -X 'GET' \
'http://192.168.10.1/lrs/retention/retention_time/28608d66-a571-44ec-94db-04a00143ff51' \
-H 'accept: application/json' \
-H 'token: token'
Path parameters
| Parameter | Description |
|---|---|
aggregate_id | Identifier of the aggregation for which the next cleanup time is requested. Required. |
Request headers
| Header | Description |
|---|---|
token | Token of the video-recorder service. Stored in the video-recorder-token secret in the ./cfg/video-recorder.secrets.json file. Required. |
Example response
"2026-08-01T01:00:00+00:00"
Starting manual data cleanup
This request initiates manual data cleanup, deleting all attempts created before the specified date.
Request schema:
POST /lrs/retention/priority_execution/<aggregate_id>?priority_date=<priority_date>&execute_as_planned=false
Example request
curl -X 'POST' \
'https://baf.3divi.ru/lrs/retention/priority_execution/28608d66-a571-44ec-94db-04a00143ff51?priority_date=2022-08-01T01%3A00%3A00%2B00%3A00&execute_as_planned=false' \
-H 'accept: application/json' \
-H 'token: token'
Query parameters
| Parameter | Description |
|---|---|
aggregate_id | Identifier of the aggregation for which manual cleanup is performed. Required. |
priority_date | Date before which all attempts will be deleted. Required. |
execute_as_planned | Internal parameter. Must always be false. Required. |
Request headers
| Header | Description |
|---|---|
token | Token of the video-recorder service. Stored in the video-recorder-token secret in the ./cfg/video-recorder.secrets.json file. Required. |