---
title: "Create data retention policy"
url: https://hexelstudio.com/docs/api/ciam-iam/retention/create
---

# Create data retention policy

**POST** `/audit/retention`

## Headers

- `Authorization: string`

  `Bearer <token>`.

## Body parameters

- `archive_enabled: optional boolean`

- `archive_target: optional string`

- `resource_type: optional string`

- `retention_days: optional integer`

## Returns

`201` Created (`RetentionPolicy`)

- `archive_enabled: optional boolean`

- `archive_target: optional string`

- `created_at: optional string`

- `created_by_user_id: optional string`

- `id: optional string`

- `is_enabled: optional boolean`

- `organization_id: optional string`

- `resource_type: optional string`

- `retention_days: optional integer`

- `updated_at: optional string`

## Errors

- `400` Bad Request
- `409` Conflict

## Example

```bash
curl --request POST \
  --url 'https://api.hexelstudio.com/v1/audit/retention' \
  --header "Authorization: Bearer $ACCESS_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{
  "archive_enabled": true,
  "archive_target": "string",
  "resource_type": "string",
  "retention_days": 0
}'
```

### Response (201)

```json
{
  "archive_enabled": true,
  "archive_target": "string",
  "created_at": "2026-01-01T00:00:00Z",
  "created_by_user_id": "string",
  "id": "string",
  "is_enabled": true,
  "organization_id": "string",
  "resource_type": "string",
  "retention_days": 0,
  "updated_at": "2026-01-01T00:00:00Z"
}
```

### Response (400)

```json
{
  "key": "string"
}
```

### Response (409)

```json
{
  "key": "string"
}
```
