Skip to content
m manifester.io
All Kafka APIs

ApiVersions

This page encodes the smallest legal instance of the request and the response: numeric fields are zero, strings and byte arrays are empty, every array carries exactly one sample element, and any records field holds one empty 61-byte RecordBatch v2. Version 4 is a flexible version, so every struct is terminated by a uvarint tagged-field count and strings and arrays carry compact length-plus-one prefixes. Sizes below include the leading int32 size prefix.

API key
18
Encoded at
v4
Flexible versions
3+
Headers
req v2, resp v0
Request versions
0-4
Response versions
0-4
Request size
18 bytes
Response size
23 bytes
framerpc headerrequest bodyRecordBatchRecordresponse bodytagged_fields

Request

ApiVersionsRequest v4, request header v2, 18 bytes on the wire

byte layout (18 bytes, 16 bytes per row)

0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0010

object tree

ApiVersionsRequest             message v4                                [0x0000, 18B]
+-- Frame                                                                [0x0000, 4B]   length-delimited framing
|   +-- size                   int32            = 14                     [0x0000, 4B]   number of bytes that follow, patched after encoding
+-- RequestHeader              v2                                        [0x0004, 11B]  common request header
|   +-- request_api_key        int16            = 18 (ApiVersions)       [0x0004, 2B]   numeric id of the API being invoked
|   +-- request_api_version    int16            = 4                      [0x0006, 2B]   version of the API being invoked
|   +-- correlation_id         int32            = 0                      [0x0008, 4B]   echoed back by the broker in the response
|   +-- client_id              nullable_string  = "" (int16 len=0)       [0x000c, 2B]   always a non-flexible int16-prefixed string
|   +-- tagged_fields          uvarint          = 0                      [0x000e, 1B]   number of tagged fields in the header
+-- ApiVersionsRequest         struct                                    [0x000f, 3B]   message body, version 4
    +-- ClientSoftwareName     string           = "" (compact, len+1=1)  [0x000f, 1B]   The name of the client.
    +-- ClientSoftwareVersion  string           = "" (compact, len+1=1)  [0x0010, 1B]   The version of the client.
    +-- tagged_fields          uvarint          = 0                      [0x0011, 1B]   number of tagged fields in this struct

kafka message schema (.json)

{
  "apiKey": 18,
  "type": "request",
  "listeners": ["broker", "controller"],
  "name": "ApiVersionsRequest",
  // Versions 0 through 2 of ApiVersionsRequest are the same.
  //
  // Version 3 is the first flexible version and adds ClientSoftwareName and ClientSoftwareVersion.
  //
  // Version 4 fixes KAFKA-17011, which blocked SupportedFeatures.MinVersion in the response from being 0.
  "validVersions": "0-4",
  "flexibleVersions": "3+",
  "fields": [
    { "name": "ClientSoftwareName", "type": "string", "versions": "3+",
      "ignorable": true, "about": "The name of the client." },
    { "name": "ClientSoftwareVersion", "type": "string", "versions": "3+",
      "ignorable": true, "about": "The version of the client." }
  ]
}

Response

ApiVersionsResponse v4, response header v0, 23 bytes on the wire

byte layout (23 bytes, 16 bytes per row)

0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0010

object tree

ApiVersionsResponse            message v4                        [0x0000, 23B]
+-- Frame                                                        [0x0000, 4B]   length-delimited framing
|   +-- size                   int32         = 19                [0x0000, 4B]   number of bytes that follow, patched after encoding
+-- ResponseHeader             v0                                [0x0004, 4B]   common response header
|   +-- correlation_id         int32         = 0                 [0x0004, 4B]   matches the correlation_id of the request
+-- ApiVersionsResponse        struct                            [0x0008, 15B]  message body, version 4
    +-- ErrorCode              int16         = 0                 [0x0008, 2B]   The top-level error code.
    +-- ApiKeys                []ApiVersion  = 1 element         [0x000a, 8B]   The APIs supported by the broker.
    |   +-- length             uvarint       = 2 (compact, n+1)  [0x000a, 1B]   one sample element follows
    |   +-- ApiVersion[0]      ApiVersion    = struct            [0x000b, 7B]
    |       +-- ApiKey         int16         = 0                 [0x000b, 2B]   The API index.
    |       +-- MinVersion     int16         = 0                 [0x000d, 2B]   The minimum supported version, inclusive.
    |       +-- MaxVersion     int16         = 0                 [0x000f, 2B]   The maximum supported version, inclusive.
    |       +-- tagged_fields  uvarint       = 0                 [0x0011, 1B]   number of tagged fields in this struct
    +-- ThrottleTimeMs         int32         = 0                 [0x0012, 4B]   The duration in milliseconds for which the request was throttled due to a q...
    +-- tagged_fields          uvarint       = 0                 [0x0016, 1B]   number of tagged fields in this struct

kafka message schema (.json)

{
  "apiKey": 18,
  "type": "response",
  "name": "ApiVersionsResponse",
  // Version 1 adds throttle time to the response.
  //
  // Starting in version 2, on quota violation, brokers send out responses before throttling.
  //
  // Version 3 is the first flexible version. Tagged fields are only supported in the body but
  // not in the header. The length of the header must not change in order to guarantee the
  // backward compatibility.
  //
  // Starting from Apache Kafka 2.4 (KIP-511), ApiKeys field is populated with the supported
  // versions of the ApiVersionsRequest when an UNSUPPORTED_VERSION error is returned.
  //
  // Version 4 fixes KAFKA-17011, which blocked SupportedFeatures.MinVersion from being 0.
  "validVersions": "0-4",
  "flexibleVersions": "3+",
  "fields": [
    { "name": "ErrorCode", "type": "int16", "versions": "0+",
      "about": "The top-level error code." },
    { "name": "ApiKeys", "type": "[]ApiVersion", "versions": "0+",
      "about": "The APIs supported by the broker.", "fields": [
      { "name": "ApiKey", "type": "int16", "versions": "0+", "mapKey": true,
        "about": "The API index." },
      { "name": "MinVersion", "type": "int16", "versions": "0+",
        "about": "The minimum supported version, inclusive." },
      { "name": "MaxVersion", "type": "int16", "versions": "0+",
        "about": "The maximum supported version, inclusive." }
    ]},
    { "name": "ThrottleTimeMs", "type": "int32", "versions": "1+", "ignorable": true,
      "about": "The duration in milliseconds for which the request was throttled due to a quota violation, or zero if the request did not violate any quota." },
    { "name": "SupportedFeatures", "type": "[]SupportedFeatureKey", "ignorable": true,
      "versions": "3+", "tag": 0, "taggedVersions": "3+",
      "about": "Features supported by the broker. Note: in v0-v3, features with MinSupportedVersion = 0 are omitted.",
      "fields": [
        { "name": "Name", "type": "string", "versions": "3+", "mapKey": true,
          "about": "The name of the feature." },
        { "name": "MinVersion", "type": "int16", "versions": "3+",
          "about": "The minimum supported version for the feature." },
        { "name": "MaxVersion", "type": "int16", "versions": "3+",
          "about": "The maximum supported version for the feature." }
      ]
    },
    { "name": "FinalizedFeaturesEpoch", "type": "int64", "versions": "3+",
      "tag": 1, "taggedVersions": "3+", "default": "-1", "ignorable": true,
      "about": "The monotonically increasing epoch for the finalized features information. Valid values are >= 0. A value of -1 is special and represents unknown epoch." },
    { "name": "FinalizedFeatures", "type": "[]FinalizedFeatureKey", "ignorable": true,
      "versions": "3+", "tag": 2, "taggedVersions": "3+",
      "about": "List of cluster-wide finalized features. The information is valid only if FinalizedFeaturesEpoch >= 0.",
      "fields": [
        { "name": "Name", "type": "string", "versions":  "3+", "mapKey": true,
          "about": "The name of the feature." },
        { "name": "MaxVersionLevel", "type": "int16", "versions":  "3+",
          "about": "The cluster-wide finalized max version level for the feature." },
        { "name": "MinVersionLevel", "type": "int16", "versions":  "3+",
          "about": "The cluster-wide finalized min version level for the feature." }
      ]
    },
    { "name": "ZkMigrationReady", "type": "bool", "versions": "3+", "taggedVersions": "3+",
      "tag": 3, "ignorable": true, "default": "false",
      "about": "Set by a KRaft controller if the required configurations for ZK migration are present." }
  ]
}