> ## Documentation Index
> Fetch the complete documentation index at: https://upstash-fix-issues-on-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Kafka Topic

> This endpoint gets details of a kafka topic.

## URL Parameters

<ParamField path="id" type="string" required>
  The ID of the kafka topic
</ParamField>

## Response Parameters

<ResponseField name="topic_id" type="string">
  ID of the new kafka topic
</ResponseField>

<ResponseField name="topic_name" type="string">
  Name of the new kafka topic
</ResponseField>

<ResponseField name="cluster_id" type="string">
  ID of the created Kafka cluster
</ResponseField>

<ResponseField name="region" type="string">
  The region the Kafka cluster is deployed in
</ResponseField>

<ResponseField name="creation_time" type="int">
  Cluster creation timestamp
</ResponseField>

<ResponseField name="state" type="string">
  State of the topic\ `active` or `deleted`
</ResponseField>

<ResponseField name="partitions" type="int">
  Number of partitions the topic has
</ResponseField>

<ResponseField name="multizone" type="boolean">
  Whether the multizone replication is enabled for the cluster or not
</ResponseField>

<ResponseField name="tcp_endpoint" type="string">
  TCP endpoint to connect to the Kafka cluster
</ResponseField>

<ResponseField name="rest_endpoint" type="string">
  REST endpoint to connect to the Kafka cluster
</ResponseField>

<ResponseField name="username" type="string">
  Cleanup policy to be used in the topic\ `compact` or `delete`
</ResponseField>

<ResponseField name="password" type="string">
  Password to be used in authenticating to the cluster
</ResponseField>

<ResponseField name="cleanup_policy" type="string">
  Max total number of partitions allowed in the cluster
</ResponseField>

<ResponseField name="max_retention_size" type="int">
  Max retention size will be allowed to topics in the cluster
</ResponseField>

<ResponseField name="max_retention_time" type="int">
  Max retention time will be allowed to topics in the cluster
</ResponseField>

<ResponseField name="max_message_size" type="int">
  Max message size will be allowed in topics in the cluster
</ResponseField>

<RequestExample>
  ```shell curl
  curl -X POST \
    https://api.upstash.com/v2/kafka/topic \
    -u 'EMAIL:API_KEY' \
    -d '{"name":"test-kafka-topic","partitions":1,"retention_time":1234,"retention_size":4567,"max_message_size":8912,"cleanup_policy":"delete","cluster_id":"9bc0e897-cbd3-4997-895a-fd77ad00aec9"}'
  ```

  ```python Python
  import requests

  data = '{"name":"test-kafka-topic","partitions":1,"retention_time":1234,"retention_size":4567,"max_message_size":8912,"cleanup_policy":"delete","cluster_id":"9bc0e897-cbd3-4997-895a-fd77ad00aec9"}'

  response = requests.post('https://api.upstash.com/v2/kafka/topic', data=data, auth=('EMAIL', 'API_KEY'))
  response.content
  ```

  ```go Go
  client := &http.Client{}
  var data = strings.NewReader(`{
      "name": "test-kafka-topic",
      "partitions": 1,
      "retention_time": 1234,
      "retention_size": 4567,
      "max_message_size": 8912,
      "cleanup_policy": "delete",
      "cluster_id": "9bc0e897-cbd3-4997-895a-fd77ad00aec9"
  }`)
  req, err := http.NewRequest("POST", "https://api.upstash.com/v2/kafka/topic", data)
  if err != nil {
      log.Fatal(err)
  }
  req.SetBasicAuth("email", "api_key")
  resp, err := client.Do(req)
  if err != nil {
      log.Fatal(err)
  }
  bodyText, err := ioutil.ReadAll(resp.Body)
  if err != nil {
      log.Fatal(err)
  }
  fmt.Printf("%s\n", bodyText);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK
  {
      "topic_id": "0f458c88-2dc6-4f69-97bb-05060e0be934",
      "topic_name": "test-kafka-topic",
      "cluster_id": "9bc0e897-cbd3-4997-895a-fd77ad00aec9",
      "region": "eu-west-1",
      "creation_time": 1643981720,
      "state": "active",
      "partitions": 1,
      "multizone": true,
      "tcp_endpoint": "sharing-mastodon-12819-eu1-kafka.upstashdev.com",
      "rest_endpoint": "sharing-mastodon-12819-eu1-rest-kafka.upstashdev.com",
      "username": "c2hhcmluZy1tYXN0b2Rvbi0xMjgxOSRV1ipriSBOwd0PHzw2KAs_cDrTXzvUKIs",
      "password": "eu8K3rYRS-ma0AsINDo7MMemmHjjRSldHJcG3c1LUMZkFfdSf9u_Kd4xCWO9_oQc",
      "cleanup_policy": "delete",
      "retention_size": 4567,
      "retention_time": 1234,
      "max_message_size": 8912
  }
  ```
</ResponseExample>
