Skip to content
m manifester.io
All Kafka APIs

CreatePartitions

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 3 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
37
Encoded at
v3
Flexible versions
2+
Headers
req v2, resp v1
Request versions
0-3
Response versions
0-3
Request size
35 bytes
Response size
20 bytes
framerpc headerrequest bodyRecordBatchRecordresponse bodytagged_fields

Request

CreatePartitionsRequest v3, request header v2, 35 bytes on the wire

byte layout (35 bytes, 16 bytes per row)

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

object tree

CreatePartitionsRequest                            message v3                                             [0x0000, 35B]
+-- Frame                                                                                                 [0x0000, 4B]   length-delimited framing
|   +-- size                                       int32                         = 31                     [0x0000, 4B]   number of bytes that follow, patched after encoding
+-- RequestHeader                                  v2                                                     [0x0004, 11B]  common request header
|   +-- request_api_key                            int16                         = 37 (CreatePartitions)  [0x0004, 2B]   numeric id of the API being invoked
|   +-- request_api_version                        int16                         = 3                      [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
+-- CreatePartitionsRequest                        struct                                                 [0x000f, 20B]  message body, version 3
    +-- Topics                                     []CreatePartitionsTopic       = 1 element              [0x000f, 14B]  Each topic that we want to create new partitions inside.
    |   +-- length                                 uvarint                       = 2 (compact, n+1)       [0x000f, 1B]   one sample element follows
    |   +-- CreatePartitionsTopic[0]               CreatePartitionsTopic         = struct                 [0x0010, 13B]
    |       +-- Name                               string                        = "" (compact, len+1=1)  [0x0010, 1B]   The topic name.
    |       +-- Count                              int32                         = 0                      [0x0011, 4B]   The new partition count.
    |       +-- Assignments                        []CreatePartitionsAssignment  = 1 element              [0x0015, 7B]   The new partition assignments.
    |       |   +-- length                         uvarint                       = 2 (compact, n+1)       [0x0015, 1B]   one sample element follows
    |       |   +-- CreatePartitionsAssignment[0]  CreatePartitionsAssignment    = struct                 [0x0016, 6B]
    |       |       +-- BrokerIds                  []int32                       = 1 element              [0x0016, 5B]   The assigned broker IDs.
    |       |       |   +-- length                 uvarint                       = 2 (compact, n+1)       [0x0016, 1B]   one sample element follows
    |       |       |   +-- int32[0]               int32                         = 0                      [0x0017, 4B]
    |       |       +-- tagged_fields              uvarint                       = 0                      [0x001b, 1B]   number of tagged fields in this struct
    |       +-- tagged_fields                      uvarint                       = 0                      [0x001c, 1B]   number of tagged fields in this struct
    +-- TimeoutMs                                  int32                         = 0                      [0x001d, 4B]   The time in ms to wait for the partitions to be created.
    +-- ValidateOnly                               bool                          = false                  [0x0021, 1B]   If true, then validate the request, but don't actually increase the number ...
    +-- tagged_fields                              uvarint                       = 0                      [0x0022, 1B]   number of tagged fields in this struct

kafka message schema (.json)

{
  "apiKey": 37,
  "type": "request",
  "listeners": ["broker", "controller"],
  "name": "CreatePartitionsRequest",
  // Version 1 is the same as version 0.
  //
  // Version 2 adds flexible version support
  //
  // Version 3 is identical to version 2 but may return a THROTTLING_QUOTA_EXCEEDED error
  // in the response if the partitions creation is throttled (KIP-599).
  "validVersions": "0-3",
  "flexibleVersions": "2+",
  "fields": [
    { "name": "Topics", "type": "[]CreatePartitionsTopic", "versions": "0+",
      "about": "Each topic that we want to create new partitions inside.",  "fields": [
      { "name": "Name", "type": "string", "versions": "0+", "mapKey": true, "entityType": "topicName",
        "about": "The topic name." },
      { "name": "Count", "type": "int32", "versions": "0+",
        "about": "The new partition count." },
      { "name": "Assignments", "type": "[]CreatePartitionsAssignment", "versions": "0+", "nullableVersions": "0+", 
        "about": "The new partition assignments.", "fields": [
        { "name": "BrokerIds", "type": "[]int32", "versions": "0+", "entityType": "brokerId",
          "about": "The assigned broker IDs." }
      ]}
    ]},
    { "name": "TimeoutMs", "type": "int32", "versions": "0+",
      "about": "The time in ms to wait for the partitions to be created." },
    { "name": "ValidateOnly", "type": "bool", "versions": "0+",
      "about": "If true, then validate the request, but don't actually increase the number of partitions." }
  ]
}

Response

CreatePartitionsResponse v3, response header v1, 20 bytes on the wire

byte layout (20 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

CreatePartitionsResponse                    message v3                                              [0x0000, 20B]
+-- Frame                                                                                           [0x0000, 4B]   length-delimited framing
|   +-- size                                int32                          = 16                     [0x0000, 4B]   number of bytes that follow, patched after encoding
+-- ResponseHeader                          v1                                                      [0x0004, 5B]   common response header
|   +-- correlation_id                      int32                          = 0                      [0x0004, 4B]   matches the correlation_id of the request
|   +-- tagged_fields                       uvarint                        = 0                      [0x0008, 1B]   number of tagged fields in the header
+-- CreatePartitionsResponse                struct                                                  [0x0009, 11B]  message body, version 3
    +-- ThrottleTimeMs                      int32                          = 0                      [0x0009, 4B]   The duration in milliseconds for which the request was throttled due to a q...
    +-- Results                             []CreatePartitionsTopicResult  = 1 element              [0x000d, 6B]   The partition creation results for each topic.
    |   +-- length                          uvarint                        = 2 (compact, n+1)       [0x000d, 1B]   one sample element follows
    |   +-- CreatePartitionsTopicResult[0]  CreatePartitionsTopicResult    = struct                 [0x000e, 5B]
    |       +-- Name                        string                         = "" (compact, len+1=1)  [0x000e, 1B]   The topic name.
    |       +-- ErrorCode                   int16                          = 0                      [0x000f, 2B]   The result error, or zero if there was no error.
    |       +-- ErrorMessage                string                         = "" (compact, len+1=1)  [0x0011, 1B]   The result message, or null if there was no error.
    |       +-- tagged_fields               uvarint                        = 0                      [0x0012, 1B]   number of tagged fields in this struct
    +-- tagged_fields                       uvarint                        = 0                      [0x0013, 1B]   number of tagged fields in this struct

kafka message schema (.json)

{
  "apiKey": 37,
  "type": "response",
  "name": "CreatePartitionsResponse",
  // Starting in version 1, on quota violation, brokers send out responses before throttling.
  //
  // Version 2 adds flexible version support
  //
  // Version 3 is identical to version 2 but may return a THROTTLING_QUOTA_EXCEEDED error
  // in the response if the partitions creation is throttled (KIP-599).
  "validVersions": "0-3",
  "flexibleVersions": "2+",
  "fields": [
    { "name": "ThrottleTimeMs", "type": "int32", "versions": "0+",
      "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": "Results", "type": "[]CreatePartitionsTopicResult", "versions": "0+",
      "about": "The partition creation results for each topic.", "fields": [
      { "name": "Name", "type": "string", "versions": "0+", "entityType": "topicName",
        "about": "The topic name." },
      { "name": "ErrorCode", "type": "int16", "versions": "0+",
        "about": "The result error, or zero if there was no error."},
      { "name": "ErrorMessage", "type": "string", "versions": "0+", "nullableVersions": "0+",
        "default": "null", "about": "The result message, or null if there was no error."}
    ]}
  ]
}