Get a Kafka cluster's metrics

Get the metrics history of each broker. Defaults to the last day, and the range can be up to 366 days. A range of up to one day returns a value for each minute, and a longer range a value for each hour.

GET https://{availability_zone}.betterstackcloud.com/v1/kafka/{id}/metrics
id string required

The ID of the Kafka cluster.

from datetime

The start of the range, included, in ISO 8601. Defaults to one day before to.

to datetime

The end of the range, not included, in ISO 8601. Defaults to now. Must be after from.

Authorization string required

Bearer $TOKEN

200 OK
{
  "kafka_id": "123456789",
  "kafka_name": "Example",
  "from": "2026-07-01T12:00:00.000Z",
  "to": "2026-07-01T12:00:00.000Z",
  "resolution": "raw",
  "brokers": [
    {
      "broker_id": "123456789",
      "node_id": 123456789,
      "data": [
        {
          "dt": "2026-07-01T12:00:00.000Z",
          "partitions": {
            "avg": 1.5,
            "max": 1,
            "limit": 50
          },
          "leader_partitions": {
            "avg": 1.5,
            "max": 1
          },
          "under_replicated_partitions": {
            "avg": 1.5,
            "max": 1
          },
          "live_brokers": {
            "avg": 1.5,
            "max": 1,
            "expected": 1
          },
          "disk": {
            "used_bytes": 1,
            "used_bytes_max": 1,
            "usable_bytes": 1
          },
          "max_consumer_group_lag": {
            "avg": 1,
            "max": 1
          }
        }
      ]
    }
  ]
}

Returns the history as one object, with a series for each broker.

kafka_id string

The cluster's ID.

kafka_name string

The cluster's name.

from datetime

The start of the range returned, included. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

to datetime

The end of the range returned, not included. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

resolution string

How far apart the values are.
Valid values:
raw: A value for each minute.
hourly: A value for each hour.

brokers array of objects

The history of each broker, with the broker's ID and its Kafka node ID.

brokers[].broker_id string

The broker id.

brokers[].node_id integer

The node id.

brokers[].data array of objects

The data.

brokers[].data[].dt datetime

In ISO 8601 format, such as 2026-07-01T12:00:00Z.

brokers[].data[].partitions object

The partitions.

brokers[].data[].partitions.avg number

The avg.

brokers[].data[].partitions.max integer

The max.

brokers[].data[].partitions.limit integer

The limit.

brokers[].data[].leader_partitions object

The leader partitions.

brokers[].data[].leader_partitions.avg number

The avg.

brokers[].data[].leader_partitions.max integer

The max.

brokers[].data[].under_replicated_partitions object

The under replicated partitions.

brokers[].data[].under_replicated_partitions.avg number

The avg.

brokers[].data[].under_replicated_partitions.max integer

The max.

brokers[].data[].live_brokers object

The live brokers.

brokers[].data[].live_brokers.avg number

The avg.

brokers[].data[].live_brokers.max integer

The max.

brokers[].data[].live_brokers.expected integer

The expected.

brokers[].data[].disk object

The disk.

brokers[].data[].disk.used_bytes integer

The used bytes.

brokers[].data[].disk.used_bytes_max integer

The used bytes max.

brokers[].data[].disk.usable_bytes integer

The usable bytes.

brokers[].data[].max_consumer_group_lag object

The max consumer group lag.

brokers[].data[].max_consumer_group_lag.avg integer

The avg.

brokers[].data[].max_consumer_group_lag.max integer

The max.