---
title: "List retention rules"
method: GET
path: "/ocs/v2.php/apps/files_retention/api/v1/retentions"
tags: ["api"]
---

# List retention rules

`GET /ocs/v2.php/apps/files_retention/api/v1/retentions`

This endpoint requires admin access

## Headers

- `OCS-APIRequest` boolean, required

## Response `200`

List retention rules

- object
  - `ocs` object, required
    - `meta` OCSMeta, required
      - `status` string, required
      - `statuscode` integer, required
      - `message` string
      - `totalitems` string
      - `itemsperpage` string
    - `data` Rule[], required
      - `id` integer, required
      - `tagid` integer, required
      - `timeunit` 0 | 1 | 2 | 3, required — 0 days, 1 weeks, 2 months, 3 years
      - `timeamount` integer, required
      - `timeafter` 0 | 1, required — 0 creation time, 1 modification time
      - `hasJob` boolean, required

## Other responses

- `401` — Current user is not logged in
- `403` — Logged in account must be an admin

## Changes

- **2025-12-20** `db5a22e1e7d3` — 2 info
  - added the non-success response with the status `401`
  - added the non-success response with the status `403`
- **2025-03-26** `e4e3f2a5e08a` — 6 warning
  - added the new `0.00` enum value to the `ocs/data/items/timeafter` response property for the response status `200`
  - added the new `0.00` enum value to the `ocs/data/items/timeunit` response property for the response status `200`
  - added the new `1.00` enum value to the `ocs/data/items/timeafter` response property for the response status `200`
  - added the new `1.00` enum value to the `ocs/data/items/timeunit` response property for the response status `200`
  - …2 more
- **2025-03-26** `ae08f25fe8aa` — 8 info
  - removed the non-success response with the status `401`
  - removed the non-success response with the status `403`
  - removed the `0.00` enum value from the `ocs/data/items/timeafter` response property for the response status `200`
  - removed the `0.00` enum value from the `ocs/data/items/timeunit` response property for the response status `200`
  - …4 more

[Change history](https://skmtc.dev/nextcloud/apis/files-retention/changes/ocs/v2.php/apps/files_retention/api/v1/retentions/get.md)

---

[API](https://skmtc.dev/nextcloud/apis/files-retention.md) · [All operations](https://skmtc.dev/nextcloud/apis/files-retention/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/nextcloud/files-retention/revisions/cc97a071cea0/schema)
