---
title: "Start a retention check"
method: POST
path: "/retention/users/{username}/check"
tags: ["data retention"]
---

# Start a retention check

`POST /retention/users/{username}/check`

Starts a new retention check for the given user. If a retention check for this user is already active a 409 status code is returned

## Request body

- FolderRetention[]
  - `path` string — virtual directory path as seen by users, if no other specific retention is defined, the retention applies for sub directories too. For example if retention is defined for the paths "/" and "/sub" then the retention for "/" is applied for any file outside the "/sub" directory
  - `retention` integer — retention time in hours. All the files with a modification time older than the defined value will be deleted. 0 means exclude this path
  - `delete_empty_dirs` boolean — if enabled, empty directories will be deleted
  - `ignore_user_permissions` boolean — if enabled, files will be deleted even if the user does not have the delete permission. The default is "false" which means that files will be skipped if the user does not have permission to delete them. File patterns filters will always be silently ignored

## Response `202`

successful operation

- ApiResponse
  - `message` string — message, can be empty
  - `error` string — error description if any

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `409` — Conflict
- `500` — Internal Server Error
- `default` — Unexpected Error

---

[API](https://skmtc.net/kanton-bern/apis/sftpgo.md) · [All operations](https://skmtc.net/kanton-bern/apis/sftpgo/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/kanton-bern/sftpgo/versions/d8d616a479b0/schema)
