delete_records
Truncate Kafka partitions by deleting records below a given offset while keeping the topic, its config, and consumer groups; preview data loss before confirming.
Instructions
Delete the oldest messages of 1 to 100 partitions in one call through items, without deleting the topic. Each item removes every message of one partition with an offset lower than before_offset; the message at before_offset becomes the first readable one. Use it to purge test data, or a run of bad messages at the head of a partition, while keeping the topic, its configuration and its consumer groups. Truncating one partition is an items array of length one.
No message is deleted unless confirm is true and the item sets acknowledge_data_loss. The preview reports the partition's start and end offsets, how many messages would be removed, and every consumer group whose committed offset is below the cut, with how many messages it would lose without ever processing them. Such a group resumes from the new start offset.
Kafka cannot restore deleted records. One confirm covers the whole batch, and deletion is not atomic: partitions truncated before a later item failed stay truncated. Results follow items order, each carrying index with result or error. Compacted topics are not supported by every broker. Requires Kafka DELETE permission on the topic.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes | The partitions to truncate, 1 to 100 of them. Truncating one partition is an array of length one. Two items naming the same topic and partition are refused before anything is deleted. | |
| confirm | No | Optional. When false or omitted, nothing is deleted and the response shows how many messages each item would remove and which consumer groups have not read them yet. Must be true to delete. One confirm covers the whole batch. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| atomic | Yes | ||
| failed | Yes | ||
| applied | Yes | ||
| results | Yes | ||
| succeeded | Yes |