List Kafka topics

List a Kafka cluster's topics, with how many partitions and copies each has and how long it keeps messages.

GET https://{availability_zone}.betterstackcloud.com/v1/kafka/{kafka_id}/topics
kafka_id string required

The ID of the Kafka cluster. Get it via betterstack kafka list.

page integer default: 1

The page to return, starting at 1.

per_page integer default: 25

How many entries to return per page. Maximum 1000.

Authorization string required

Bearer $TOKEN

Results are paginated

Use page and per_page to move through pages. See Pagination.

200 OK
{
  "data": [
    {
      "id": "example",
      "name": "Example Kafka topic",
      "partitions": 1,
      "replication_factor": 1,
      "retention_bytes": 1,
      "retention_ms": 1,
      "cleanup_policy": "delete",
      "max_message_bytes": 1,
      "budget_bytes": 1,
      "created_at": "2026-07-01T12:00:00.000Z",
      "updated_at": "2026-07-01T12:00:00.000Z"
    }
  ],
  "meta": {}
}

Returns the list of Kafka topics.

id string

The topic's ID, a UUID. Get, update and delete a topic by this ID, never by its name.

name string

The topic's name, unique in the cluster, 1–249 letters, digits, dots, hyphens and underscores. Can't be . or .. or start with __. Can't be changed after the topic is created.

partitions integer

The number of partitions, at least 1. All topics together must fit within the cluster type's max_partitions.

replication_factor integer

The number of copies of each partition, the same as the cluster's number of brokers.

retention_bytes integer

The most data to keep in each partition, in bytes, at least 1048576.

retention_ms integer

How long to keep messages, in milliseconds, at least 60000. -1 keeps them with no time limit, and retention_bytes still limits their size.

cleanup_policy string

How Kafka removes old messages.
Valid values:
delete: Deletes messages older than the retention time or past the retention size.
compact: Keeps only the latest message for each key.
compact_delete: Keeps only the latest message for each key, and also deletes messages past retention. Kafka calls it compact,delete.

max_message_bytes integer

The largest message the topic accepts, in bytes, from 1024 to 8388608.

budget_bytes integer

The most disk space the topic can use on each broker, in bytes. The budget is partitions times retention_bytes, plus one segment for each partition.

created_at datetime or null

When the topic was created. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

updated_at datetime or null

When the topic was last updated. In ISO 8601 format, such as 2026-07-01T12:00:00Z.