> ## Documentation Index
> Fetch the complete documentation index at: https://www.artie.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Change Kafka topic retention

> Sets a topic's retention.ms. Potentially destructive: Kafka deletes messages older than the new retention, and on Artie-managed topics that can drop change events before Artie pipelines read them. Kafka-internal (__) topics can't change. On a Managed Kafka cluster Cruise Control's (strimzi.cruisecontrol.*) can't either, and the cluster must be active (409 otherwise).

`POST /kafka-clusters/{uuid}/topics/{topic}/retention`

Sets a topic's `retention.ms`. Potentially destructive: Kafka deletes messages older than the new retention, and on Artie-managed topics that can drop change events before Artie pipelines read them. Kafka-internal (`__`) topics can't change. On a Managed Kafka cluster Cruise Control's (`strimzi.cruisecontrol.*`) can't either, and the cluster must be active (409 otherwise).

## Authorization

* `Authorization` (header): API key passed as a Bearer token in the Authorization header.

## Path parameters

* `topic` (string, required)
* `uuid` (string, required)

## Body (application/json)

* `retentionMS` (integer, required): New retention.ms: at least 86400000 (one day), or -1 to keep messages forever.

## Example request

```bash
curl --request POST \
  --url https://api.artie.com/kafka-clusters/{uuid}/topics/{topic}/retention \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "retentionMS": 123
}'
```

## Responses

### 204 No Content

### 400 Bad Request

### 404 Not Found

### 409 Conflict

### 500 Internal Server Error

### 502 Bad Gateway