This document specifies the Kafka protocol APIs used for cluster administration, including topic management, configuration, ACL management, and cluster operations.
API Key Name Purpose 19 CreateTopics Create new topics 20 DeleteTopics Delete existing topics 21 DeleteRecords Delete records before offset 37 CreatePartitions Add partitions to topics
API Key Name Purpose 32 DescribeConfigs Retrieve configurations 33 AlterConfigs Replace configurations (deprecated) 44 IncrementalAlterConfigs Modify configurations incrementally
API Key Name Purpose 29 DescribeAcls List ACL entries 30 CreateAcls Create ACL entries 31 DeleteAcls Delete ACL entries
API Key Name Purpose 34 AlterReplicaLogDirs Move replicas between directories 35 DescribeLogDirs Query log directory usage 43 ElectLeaders Trigger leader election 45 AlterPartitionReassignments Reassign partitions 46 ListPartitionReassignments Query reassignment status 60 DescribeCluster Describe cluster metadata
API Key Name Purpose 80 AddRaftVoter Add voter to KRaft quorum 81 RemoveRaftVoter Remove voter from KRaft quorum 82 UpdateRaftVoter Update KRaft voter endpoints
The CreateTopics API creates new topics with specified configurations.
Version Kafka Key Changes 0 0.10.1 Initial version (removed in 4.0) 1 0.10.2 Error message (removed in 4.0) 2 0.11.0 Throttle time (4.0 baseline) 3 1.0.0 Response before quota throttling 4 2.0.0 KIP-464 optional partitions/replication 5 2.4.0 Flexible versions; response configs (KIP-525) 6 2.7.0 KIP-599 THROTTLING_QUOTA_EXCEEDED 7 3.0.0 KIP-516 topic ID
replication_factor: INT16
assignments: [Assignment]
Field Type Description nameSTRING Topic name num_partitionsINT32 Number of partitions (-1 for default) replication_factorINT16 Replication factor (-1 for default) assignmentsARRAY Manual replica assignments (optional) configsARRAY Topic-level configurations timeout_msINT32 Operation timeout validate_onlyBOOLEAN Only validate, do not create
error_message: NULLABLE_STRING
topic_config_error_code: INT16
replication_factor: INT16
Aspect Guarantee Atomicity Each topic creation is independent Validation Configs validated before creation Timeout TIMEOUT error does not mean failure Idempotence TOPIC_ALREADY_EXISTS if topic exists
Timeout Behavior
A REQUEST_TIMED_OUT response does not indicate failure. The topic may still be created. Clients should query metadata to verify topic state.
Error Code Retriable Cause Recovery TOPIC_ALREADY_EXISTS ❌ Topic exists Skip or delete first INVALID_TOPIC ❌ Invalid topic name Fix name INVALID_REPLICATION_FACTOR ❌ RF > available brokers Reduce RF INVALID_PARTITIONS ❌ Invalid partition count Fix count TOPIC_AUTHORIZATION_FAILED ❌ No Create permission Check ACLs REQUEST_TIMED_OUT ✅ Operation timeout Check metadata, retry
The DeleteTopics API deletes topics and all their data.
Version Kafka Key Changes 0 0.10.1 Initial version (removed in 4.0) 1 0.10.2 Throttle time (4.0 baseline) 2 0.11.0 Response before quota throttling 3 1.2.0 TOPIC_DELETION_DISABLED error 4 2.4.0 Flexible versions 5 2.8.0 Error message; THROTTLING_QUOTA_EXCEEDED 6 3.0.0 Topic ID support
Field Type Description topicsARRAY Topics to delete (v6+; by name or ID) topic_namesARRAY Topic names to delete (v0-5) timeout_msINT32 Operation timeout
error_message: NULLABLE_STRING
Aspect Guarantee Irreversibility Deletion cannot be undone Asynchronous Deletion may complete after response Data loss All partition data permanently lost Metadata Topic removed from cluster metadata
Irreversible Operation
Topic deletion permanently destroys all data in the topic. There is no recovery mechanism.
The CreatePartitions API adds partitions to existing topics.
Version Kafka Key Changes 0 1.0.0 Initial version 1 2.0.0 Response improvements 2 2.4.0 Flexible versions 3 2.8.0 KIP-516
CreatePartitionsRequest =>
assignments: [Assignment]
Field Type Description countINT32 New total partition count assignmentsARRAY Manual replica assignments for new partitions
CreatePartitionsResponse =>
error_message: NULLABLE_STRING
Aspect Guarantee Increase only Can only increase partition count Key distribution Existing key distribution changes Data preservation Existing partition data preserved
Key Distribution Impact
Adding partitions changes key-to-partition mapping. Keys previously routing to partition N may route to new partitions. This affects ordering guarantees for keyed messages.
The DescribeConfigs API retrieves configuration for resources (brokers, topics, etc.).
Version Kafka Key Changes 0 0.11.0 Initial version 1 1.0.0 Include synonyms 2 2.0.0 Response improvements 3 2.1.0 Include documentation 4 2.4.0 Flexible versions
DescribeConfigsRequest =>
include_synonyms: BOOLEAN
include_documentation: BOOLEAN
configuration_keys: [STRING]
Field Type Description resource_typeINT8 Resource type (see below) resource_nameSTRING Resource name (topic/broker ID) configuration_keysARRAY Keys to fetch (null for all)
Value Type Description 0 UNKNOWN Unknown (invalid) 2 TOPIC Topic configuration 4 BROKER Broker configuration 8 BROKER_LOGGER Broker logger level 16 CLIENT_METRICS Client metrics 32 GROUP Group configuration
DescribeConfigsResponse =>
error_message: NULLABLE_STRING
documentation: NULLABLE_STRING
Value Source Description 0 UNKNOWN Unknown source 1 TOPIC_CONFIG Dynamic topic config 2 DYNAMIC_BROKER_CONFIG Dynamic broker config 3 DYNAMIC_DEFAULT_BROKER_CONFIG Dynamic broker default 4 STATIC_BROKER_CONFIG Static broker config 5 DEFAULT_CONFIG Built-in default 6 DYNAMIC_BROKER_LOGGER_CONFIG Dynamic broker logger config 7 CLIENT_METRICS_CONFIG Dynamic client metrics config 8 GROUP_CONFIG Dynamic group config
The IncrementalAlterConfigs API modifies configurations incrementally without replacing all values.
Version Kafka Key Changes 0 2.3.0 Initial version 1 2.4.0 Flexible versions
IncrementalAlterConfigsRequest =>
Field Type Description config_operationINT8 Operation type
Value Operation Description 0 SET Set config value 1 DELETE Remove config override 2 APPEND Append to list config 3 SUBTRACT Remove from list config
IncrementalAlterConfigsResponse =>
error_message: NULLABLE_STRING
The DescribeAcls API queries ACL entries matching specified filters.
Version Kafka Key Changes 0 0.11.0 Initial version 1 2.0.0 Throttle time 2 2.4.0 Flexible versions 3 3.0.0 KIP-516
resource_type_filter: INT8
resource_name_filter: NULLABLE_STRING
pattern_type_filter: INT8
principal_filter: NULLABLE_STRING
host_filter: NULLABLE_STRING
Field Type Description resource_type_filterINT8 Resource type (ANY for all) pattern_type_filterINT8 Pattern type (ANY for all) operationINT8 Operation (ANY for all) permission_typeINT8 ALLOW or DENY (ANY for all)
Value Type 0 UNKNOWN 1 ANY 2 TOPIC 3 GROUP 4 CLUSTER 5 TRANSACTIONAL_ID 6 DELEGATION_TOKEN 7 USER
Value Operation 0 UNKNOWN 1 ANY 2 ALL 3 READ 4 WRITE 5 CREATE 6 DELETE 7 ALTER 8 DESCRIBE 9 CLUSTER_ACTION 10 DESCRIBE_CONFIGS 11 ALTER_CONFIGS 12 IDEMPOTENT_WRITE 13 CREATE_TOKENS 14 DESCRIBE_TOKENS
Value Type Description 0 UNKNOWN Unknown (invalid) 1 ANY Match any pattern 2 MATCH Matches resource name pattern 3 LITERAL Exact resource name match 4 PREFIXED Resource name prefix match
error_message: NULLABLE_STRING
The CreateAcls API creates new ACL entries.
Version Kafka Key Changes 0 0.11.0 Initial version 1 2.0.0 Response improvements 2 2.4.0 Flexible versions 3 3.0.0 KIP-516
resource_pattern_type: INT8
Field Type Description principalSTRING Principal (e.g., "User:alice") hostSTRING Host ("*" for any) permission_typeINT8 2=DENY, 3=ALLOW
error_message: NULLABLE_STRING
The DeleteAcls API deletes ACL entries matching filters.
Version Kafka Key Changes 0 0.11.0 Initial version 1 2.0.0 Response improvements 2 2.4.0 Flexible versions 3 3.0.0 KIP-516
resource_type_filter: INT8
resource_name_filter: NULLABLE_STRING
pattern_type_filter: INT8
principal_filter: NULLABLE_STRING
host_filter: NULLABLE_STRING
filter_results: [FilterResult]
error_message: NULLABLE_STRING
matching_acls: [MatchingAcl]
error_message: NULLABLE_STRING
The ElectLeaders API triggers leader election for partitions.
Version Kafka Key Changes 0 2.2.0 Initial version (preferred leaders) 1 2.4.0 KIP-460 election types 2 2.4.0 Flexible versions
topic_partitions: [TopicPartition]
Field Type Description election_typeINT8 0=PREFERRED, 1=UNCLEAN topic_partitionsARRAY Partitions (null for all)
Value Type Description 0 PREFERRED Elect preferred leader (must be in ISR) 1 UNCLEAN Elect any available replica (data loss risk)
Unclean Leader Election
Unclean leader election (type=1) may result in data loss if the elected replica is behind the previous leader.
replica_election_results: [ReplicaElectionResult]
partition_result: [PartitionResult]
error_message: NULLABLE_STRING
The AlterPartitionReassignments API reassigns partition replicas to different brokers.
Version Kafka Key Changes 0 2.4.0 Initial version
AlterPartitionReassignmentsRequest =>
Field Type Description replicasARRAY New replica list (null to cancel)
AlterPartitionReassignmentsResponse =>
error_message: NULLABLE_STRING
error_message: NULLABLE_STRING
Aspect Guarantee Progress Data copied before old replicas removed Availability Partition remains available during reassignment Cancellation Set replicas to null to cancel
The DescribeLogDirs API queries log directory usage on brokers.
Version Kafka Key Changes 0 0.11.0 Initial version (removed in 4.0) 1 2.0.0 Throttle time (4.0 baseline) 2 2.4.0 Flexible versions 3 2.7.0 Top-level error code 4 3.5.0 Total/usable bytes (KIP-827)
DescribeLogDirsRequest =>
Field Type Description topicsARRAY Topics to query (null for all)
DescribeLogDirsResponse =>
Field Type Description log_dirSTRING Log directory path total_bytesINT64 Total size of the log volume (excludes remote storage) usable_bytesINT64 Usable size of the log volume (excludes remote storage) partition_sizeINT64 Partition data size offset_lagINT64 Replication lag (future replicas)
The DescribeCluster API retrieves cluster metadata including controller and broker information.
Version Kafka Key Changes 0 3.0.0 Initial version 1 3.4.0 EndpointType (KIP-919) 2 3.9.0 IncludeFencedBrokers (KIP-1073)
DescribeClusterRequest =>
include_cluster_authorized_operations: BOOLEAN
include_fenced_brokers: BOOLEAN
DescribeClusterResponse =>
error_message: NULLABLE_STRING
cluster_authorized_operations: INT32
Practice Rationale Use validate_only before creation Catch errors before commit Verify topic state after timeout Timeout does not mean failure Plan partition count carefully Cannot decrease partitions Use rack-aware assignments Improve fault tolerance
Practice Rationale Use PREFIXED patterns for hierarchy Simplify permission management Audit ACLs regularly Detect permission drift Test ACL changes in non-prod Prevent access issues Document ACL policies Enable consistent management
Practice Rationale Use IncrementalAlterConfigs Avoid replacing all configs Track config changes Enable rollback Test config changes Prevent cluster issues Use describe before alter Understand current state