Skip to content

Delete records or empty a topic

POST
/api/v1/clusters/{id}/topics/{topic}/delete-records
curl --request POST \
--url http://localhost:8080/api/v1/clusters/example/topics/example/delete-records \
--header 'Content-Type: application/json' \
--header 'X-Brokerium-Request: 1' \
--cookie brokerium_session=<brokerium_session> \
--data '{ "partitions": [ { "partition": 1, "offset": 1 } ], "beforeTimestamp": 1, "all": true, "dryRun": true, "confirm": "example" }'

Brokerium Enterprise, feature message-tools. Role: operator. Deletes the records before an offset in each listed partition, the records older than a time, or all records (Kafka DeleteRecords). Offsets past the end are clamped to the end. A dry run shows what would be deleted; otherwise confirm must repeat the topic name. Topics whose cleanup.policy does not include delete answer 409 compacted_topic.

id
required
string
topic
required
string
X-Brokerium-Request
required
string
Allowed value: 1

Required on every non-GET request.

Media typeapplication/json

Exactly one of partitions, beforeTimestamp and all.

object
partitions
Array<object>
object
partition
required
integer format: int32
offset
required

The records before this offset are deleted.

integer format: int64
beforeTimestamp

Unix milliseconds.

integer format: int64
all
boolean
dryRun
boolean
confirm

The topic name; required unless dryRun is set.

string

Example generated

{
"partitions": [
{
"partition": 1,
"offset": 1
}
],
"beforeTimestamp": 1,
"all": true,
"dryRun": true,
"confirm": "example"
}

Planned or performed deletion.

Media typeapplication/json
object
partitions

Partitions with records to delete.

Array<object>
object
partition
integer format: int32
startOffset
integer format: int64
endOffset
integer format: int64
deleteBefore

The new start offset.

integer format: int64
records
integer format: int64
error

Why the deletion failed in this partition.

string
records
integer format: int64
failed

Partitions where the deletion failed.

integer
dryRun
boolean

Example generated

{
"partitions": [
{
"partition": 1,
"startOffset": 1,
"endOffset": 1,
"deleteBefore": 1,
"records": 1,
"error": "example"
}
],
"records": 1,
"failed": 1,
"dryRun": true
}

Error.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

Error.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

Error.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

Error.

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string

Example generated

{
"error": {
"code": "example",
"message": "example"
}
}

Apache®, Apache Kafka® and Kafka® are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries. Brokerium is not affiliated with, endorsed by, or sponsored by the Apache Software Foundation.