---
search:
  tags:
    - settings
    - PUT
seo:
  description: >-
    Saves the retention and restarts the metrics engine… Reference for the PUT
    /api/v1/settings/monitoring/retention endpoint in the TimescaleDB Enterprise
    API.
  noindex: true
sidebar:
  label: Set metrics retention
  badge: PUT
title: Set metrics retention
type: openapi-operation
---
Saves the retention and restarts the metrics engine with it. The charts have no new data for some seconds. A shorter retention deletes the older metrics.

`PUT /api/v1/settings/monitoring/retention`

**Request body** (`application/json`, required)

- `days` (integer<int64>, required) — How many days the metrics engine keeps metrics

Request body example:

```json
{
  "days": 1
}
```

**Responses**

- `200` — OK
- `default` — Error

Response example, 200:

```json
{
  "mirror_enabled": true,
  "mirror_token_created_at": "2019-08-24T14:15:22Z",
  "mirror_token_set": true,
  "retention_days": 0,
  "retention_days_max": 0,
  "retention_days_min": 0,
  "storage_bytes": 0
}
```
