Skip to content
m manifester.io
All Kafka APIs

DeleteTopics

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 6 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
20
Encoded at
v6
Flexible versions
4+
Headers
req v2, resp v1
Request versions
1-6
Response versions
1-6
Request size
39 bytes
Response size
36 bytes
framerpc headerrequest bodyRecordBatchRecordresponse bodytagged_fields

Request

DeleteTopicsRequest v6, request header v2, 39 bytes on the wire

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

DeleteTopicsRequest              message v6                                                  [0x0000, 39B]
+-- Frame                                                                                    [0x0000, 4B]   length-delimited framing
|   +-- size                     int32               = 35                                    [0x0000, 4B]   number of bytes that follow, patched after encoding
+-- RequestHeader                v2                                                          [0x0004, 11B]  common request header
|   +-- request_api_key          int16               = 20 (DeleteTopics)                     [0x0004, 2B]   numeric id of the API being invoked
|   +-- request_api_version      int16               = 6                                     [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
+-- DeleteTopicsRequest          struct                                                      [0x000f, 24B]  message body, version 6
    +-- Topics                   []DeleteTopicState  = 1 element                             [0x000f, 19B]  The name or topic ID of the topic.
    |   +-- length               uvarint             = 2 (compact, n+1)                      [0x000f, 1B]   one sample element follows
    |   +-- DeleteTopicState[0]  DeleteTopicState    = struct                                [0x0010, 18B]
    |       +-- Name             string              = "" (compact, len+1=1)                 [0x0010, 1B]   The topic name.
    |       +-- TopicId          uuid                = 00000000-0000-0000-0000-000000000000  [0x0011, 16B]  The unique topic ID.
    |       +-- tagged_fields    uvarint             = 0                                     [0x0021, 1B]   number of tagged fields in this struct
    +-- TimeoutMs                int32               = 0                                     [0x0022, 4B]   The length of time in milliseconds to wait for the deletions to complete.
    +-- tagged_fields            uvarint             = 0                                     [0x0026, 1B]   number of tagged fields in this struct

kafka message schema (.json)

{
  "apiKey": 20,
  "type": "request",
  "listeners": ["broker", "controller"],
  "name": "DeleteTopicsRequest",
  // Version 0 was removed in Apache Kafka 4.0, Version 1 is the new baseline.
  // Versions 0, 1, 2, and 3 are the same.
  //
  // Version 4 is the first flexible version.
  //
  // Version 5 adds ErrorMessage in the response and may return a THROTTLING_QUOTA_EXCEEDED error
  // in the response if the topics deletion is throttled (KIP-599).
  //
  // Version 6 reorganizes topics, adds topic IDs and allows topic names to be null.
  "validVersions": "1-6",
  "flexibleVersions": "4+",
  "fields": [
    { "name": "Topics", "type": "[]DeleteTopicState", "versions": "6+", "about": "The name or topic ID of the topic.",
      "fields": [
        {"name": "Name", "type": "string", "versions": "6+", "nullableVersions": "6+", "default": "null", "entityType": "topicName", "about": "The topic name."},
        {"name": "TopicId", "type": "uuid", "versions": "6+", "about": "The unique topic ID."}
    ]},
    { "name": "TopicNames", "type": "[]string", "versions": "0-5", "entityType": "topicName", "ignorable": true,
      "about": "The names of the topics to delete." },
    { "name": "TimeoutMs", "type": "int32", "versions": "0+",
      "about": "The length of time in milliseconds to wait for the deletions to complete." }
  ]
}

Response

DeleteTopicsResponse v6, response header v1, 36 bytes on the wire

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

DeleteTopicsResponse                 message v6                                                      [0x0000, 36B]
+-- Frame                                                                                            [0x0000, 4B]   length-delimited framing
|   +-- size                         int32                   = 32                                    [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
+-- DeleteTopicsResponse             struct                                                          [0x0009, 27B]  message body, version 6
    +-- ThrottleTimeMs               int32                   = 0                                     [0x0009, 4B]   The duration in milliseconds for which the request was throttled due to a q...
    +-- Responses                    []DeletableTopicResult  = 1 element                             [0x000d, 22B]  The results for each topic we tried to delete.
    |   +-- length                   uvarint                 = 2 (compact, n+1)                      [0x000d, 1B]   one sample element follows
    |   +-- DeletableTopicResult[0]  DeletableTopicResult    = struct                                [0x000e, 21B]
    |       +-- Name                 string                  = "" (compact, len+1=1)                 [0x000e, 1B]   The topic name.
    |       +-- TopicId              uuid                    = 00000000-0000-0000-0000-000000000000  [0x000f, 16B]  The unique topic ID.
    |       +-- ErrorCode            int16                   = 0                                     [0x001f, 2B]   The deletion error, or 0 if the deletion succeeded.
    |       +-- ErrorMessage         string                  = "" (compact, len+1=1)                 [0x0021, 1B]   The error message, or null if there was no error.
    |       +-- tagged_fields        uvarint                 = 0                                     [0x0022, 1B]   number of tagged fields in this struct
    +-- tagged_fields                uvarint                 = 0                                     [0x0023, 1B]   number of tagged fields in this struct

kafka message schema (.json)

{
  "apiKey": 20,
  "type": "response",
  "name": "DeleteTopicsResponse",
  // Version 0 was removed in Apache Kafka 4.0, Version 1 is the new baseline.
  //
  // Version 1 adds the throttle time.
  //
  // Starting in version 2, on quota violation, brokers send out responses before throttling.
  //
  // Starting in version 3, a TOPIC_DELETION_DISABLED error code may be returned.
  //
  // Version 4 is the first flexible version.
  //
  // Version 5 adds ErrorMessage in the response and may return a THROTTLING_QUOTA_EXCEEDED error
  // in the response if the topics deletion is throttled (KIP-599).
  //
  // Version 6 adds topic ID to responses. An UNSUPPORTED_VERSION error code will be returned when attempting to
  // delete using topic IDs when IBP < 2.8. UNKNOWN_TOPIC_ID error code will be returned when IBP is at least 2.8, but
  // the topic ID was not found.
  "validVersions": "1-6",
  "flexibleVersions": "4+",
  "fields": [
    { "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": "Responses", "type": "[]DeletableTopicResult", "versions": "0+",
      "about": "The results for each topic we tried to delete.", "fields": [
      { "name": "Name", "type": "string", "versions": "0+", "nullableVersions": "6+", "mapKey": true, "entityType": "topicName",
        "about": "The topic name." },
      {"name": "TopicId", "type": "uuid", "versions": "6+", "ignorable": true, "about": "The unique topic ID."},
      { "name": "ErrorCode", "type": "int16", "versions": "0+",
        "about": "The deletion error, or 0 if the deletion succeeded." },
      { "name": "ErrorMessage", "type": "string", "versions": "5+", "nullableVersions": "5+", "ignorable": true, "default": "null",
        "about": "The error message, or null if there was no error." }
    ]}
  ]
}