> ## 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 Stats

> This endpoint gets detailed stats of a Kafka cluster.

## URL Parameters

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

## Response Parameters

<ResponseField name="throughput" type="Object">
  <Expandable title="Properties">
    <ResponseField name="x" type="string">
      Timestamp indicating when the measurement was taken.
    </ResponseField>

    <ResponseField name="y" type="int">
      Number of monthly messages in Kafka topic
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="produce_throughput" type="Object">
  <Expandable title="Properties">
    <ResponseField name="x" type="string">
      Timestamp indicating when the measurement was taken.
    </ResponseField>

    <ResponseField name="y" type="int">
      Number of monthly messages produced in Kafka topic
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="consume_throughput" type="Object">
  <Expandable title="Properties">
    <ResponseField name="x" type="string">
      Timestamp indicating when the measurement was taken.
    </ResponseField>

    <ResponseField name="y" type="int">
      Number of monthly messages consumed in Kafka topic
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="diskusage" type="Object">
  <Expandable title="Properties">
    <ResponseField name="x" type="string">
      Timestamp indicating when the measurement was taken.
    </ResponseField>

    <ResponseField name="y" type="int">
      Total disk usage of the Kafka topic
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="total_monthly_storage" type="int">
  Average storage size of the Kafka topic in the current month
</ResponseField>

<ResponseField name="total_monthly_produce" type="int">
  Total number of monthly produced messages to the Kafka topic
</ResponseField>

<ResponseField name="total_monthly_consume" type="int">
  Total number of monthly consumed messages from the Kafka topic
</ResponseField>

<RequestExample>
  ```shell curl
  curl -X GET \
    https://api.upstash.com/v2/kafka/stats/topic/:id \
    -u 'EMAIL:API_KEY'
  ```

  ```python Python
  import requests

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

  ```go Go
  client := &http.Client{}
  req, err := http.NewRequest("GET", "https://api.upstash.com/v2/kafka/stats/topic/:id", nil)
  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
  {
    "throughput": [
      {
        "x": "2022-02-07 12:05:11",
        "y": 0
      }
      ...
    ],
    "produce_throughput": [
      {
        "x": "2022-02-07 12:05:11",
        "y": 0
      }
      ...
    ],
    "consume_throughput": [
      {
        "x": "2022-02-07 12:05:11",
        "y": 0
      }
      ...
    ],
    "diskusage": [
      {
        "x": "2022-02-07 12:20:11",
        "y": 0
      }
      ...
    ],
    "total_monthly_storage": 0,
    "total_monthly_produce": 0,
    "total_monthly_consume": 0
  }
  ```
</ResponseExample>
