---
title: "Update Retention Policy"
method: PUT
path: "/retentions/{id}"
tags: ["Retention"]
---

# Update Retention Policy

`PUT /retentions/{id}`

Update Retention Policy, you can reference metadatas API for the policy model. You can check project metadatas to find whether a retention policy is already binded. This method should only be called when retention policy has already binded to project.

## Path parameters

- `id` integer, required

## Headers

- `X-Request-Id` string

## Request body

- RetentionPolicy — retention policy
  - `id` integer
  - `algorithm` string
  - `rules` RetentionRule[]
    - `id` integer
    - `priority` integer
    - `disabled` boolean
    - `action` string
    - `template` string
    - `params` object
    - `tag_selectors` RetentionSelector[]
      - `kind` string
      - `decoration` string
      - `pattern` string
      - `extras` string
    - `scope_selectors` object
  - `trigger` RetentionRuleTrigger
    - `kind` string
    - `settings` object
    - `references` object
  - `scope` RetentionPolicyScope
    - `level` string
    - `ref` integer

## Response `200`

Update Retention Policy successfully.

## Other responses

- `401` — Unauthorized
- `403` — Forbidden
- `500` — Internal server error

---

[API](https://skmtc.dev/goharbor/apis/harbor-api.md) · [All operations](https://skmtc.dev/goharbor/apis/harbor-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/goharbor/harbor-api/revisions/62d78801f8df/schema)
