---
title: "Create new retention policy for a database"
method: POST
path: "/sources/{id}/dbs/{db}/rps"
tags: ["retention policies"]
---

# Create new retention policy for a database

`POST /sources/{id}/dbs/{db}/rps`

## Path parameters

- `id` string, required
- `db` string, required

## Request body

- RetentionPolicy
  - `name` string, required — The identifying name of the retention policy
  - `duration` string, required — the duration of the retention policy
  - `replication` integer, required — how many copies of the data are stored in the cluster
  - `shardDuration` string — the interval spanned by each shard group
  - `default` boolean — Indicates whether this retention policy should be the default
  - `links` object
    - `self` string, url — Self link mapping to this resource

## Response `201`

Retention Policy successfully created.

- RetentionPolicy
  - `name` string, required — The identifying name of the retention policy
  - `duration` string, required — the duration of the retention policy
  - `replication` integer, required — how many copies of the data are stored in the cluster
  - `shardDuration` string — the interval spanned by each shard group
  - `default` boolean — Indicates whether this retention policy should be the default
  - `links` object
    - `self` string, url — Self link mapping to this resource

## Other responses

- `404` — Data source id does not exist.
- `default` — A processing or an unexpected error.

---

[API](https://skmtc.net/influxdata/apis/chronograf.md) · [All operations](https://skmtc.net/influxdata/apis/chronograf/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/influxdata/chronograf/revisions/ce55d963b4ac/schema)
