What is Metadata?
The first API every client calls after connecting, and re-called on NOT_LEADER or UNKNOWN_TOPIC_OR_PARTITION errors. A surge in Metadata requests signals partition leaders are moving around, typically during rolling restarts, broker failures, or reassignments.
Wire Diagram
Request Header · flexible
message_size
int32 · 4B
api_key
int16 · 2B
api_version
int16 · 2B
correlation_id
int32 · 4B
client_id
string (compact)
tagged
var
MetadataRequest v11
AllowAutoTopicCreation
bool · 1B
IncludeTopicAuthorizedOperations
bool · 1B
tagged
var
TopicId
uuid · 16B
Name?
string (compact)
tagged
var
Schema & Example
Schema { "Topics": [{ "TopicId": uuid, "Name": string? }]?, "AllowAutoTopicCreation": bool, "IncludeTopicAuthorizedOperations": bool }
Example { "Topics": [{ "TopicId": "550e8400-e29b-41d4-a716-446655440000", "Name": "orders" }]?, "AllowAutoTopicCreation": true, "IncludeTopicAuthorizedOperations": 2 }