> ## 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 settings

> Changes a topic's retention and tiered storage; send only the settings to change. 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 neither can Cruise Control's (strimzi.cruisecontrol.*), and the cluster must be active (409 otherwise). A change the rules refuse is a 400 that says why.

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

Changes a topic's retention and tiered storage; send only the settings to change. 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 neither can Cruise Control's (`strimzi.cruisecontrol.*`), and the cluster must be active (409 otherwise). A change the rules refuse is a 400 that says why.

## 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)

* `localRetentionMS` (integer | null): How long the tiered topic keeps data on broker disks: from 86400000 (one day) up to retention. Turning tiered storage on without it uses 7 days, capped at retention; on a Managed Kafka cluster it uses the cluster's days on disk.
* `retentionMS` (integer | null): New retention.ms: at least 86400000 (one day); or -1 to keep messages forever.
* `tieredStorage` (string | null): off, on or paused. A topic that's on can only be paused, and only a paused topic can be turned off, which deletes its data in remote storage. Pausing keeps that data readable until retention expires it. One of: `off`, `on`, `paused`, `null`.

## Example request

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

## Responses

### 200 OK

* `artieManaged` (boolean, required): Whether Artie manages this topic: a CDC topic under the company prefix outside the customer namespace, or a Kafka-internal __ topic.
* `localRetentionMS` (string): How long a tiered topic keeps data on broker disks (local.retention.ms). -2 means the same as retention. Left out when the brokers don't report it.
* `partitionCount` (integer, required)
* `retentionMS` (string, required)
* `sourceName` (string)
* `tableName` (string)
* `tieredStorage` (object, required)
  * `canTier` (boolean, required): Whether tiered storage can be on for this topic. Kafka refuses it on compacted topics, and Artie keeps it off Kafka's and Cruise Control's own topics and topics whose retention can't be read.
  * `state` (string, required): off, on or paused, from the topic's remote.storage.enable and remote.log.copy.disable configs. One of: `off`, `on`, `paused`.
  * `switchOn` (boolean, required): Whether the topic's tiered storage switch is on. On a Managed Kafka cluster it's the topic's own switch, else the cluster's tierAllTopics; elsewhere it's whether the topic is tiered (on or paused).
* `topic` (string, required)

```json
{
  "artieManaged": true,
  "localRetentionMS": "<string>",
  "partitionCount": 123,
  "retentionMS": "<string>",
  "sourceName": "<string>",
  "tableName": "<string>",
  "tieredStorage": {
    "canTier": true,
    "state": "off",
    "switchOn": true
  },
  "topic": "<string>"
}
```

### 400 Bad Request

### 404 Not Found

### 409 Conflict

### 500 Internal Server Error

### 502 Bad Gateway