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

> This endpoint gets detailed stats of a database.

## URL Parameters

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

## Response Parameters

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

    <ResponseField name="y" type="int">
      Total number of connections momentarily
    </ResponseField>
  </Expandable>
</ResponseField>

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

    <ResponseField name="y" type="int">
      Total number keys exists in the database
    </ResponseField>
  </Expandable>
</ResponseField>

<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">
      Throughput seen on the database connections
    </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">
      Throughput seen on the database connections for write requests
    </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">
      Throughput seen on the database connections for read requests
    </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 amount of this usage of the database
    </ResponseField>
  </Expandable>
</ResponseField>

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

    <ResponseField name="y" type="int">
      Maximum server latency observed in the last hour
    </ResponseField>
  </Expandable>
</ResponseField>

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

    <ResponseField name="y" type="int">
      Minimum server latency observed in the last hour
    </ResponseField>
  </Expandable>
</ResponseField>

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

    <ResponseField name="y" type="int">
      The average read latency value measured in the last hour
    </ResponseField>
  </Expandable>
</ResponseField>

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

    <ResponseField name="y" type="int">
      The 99th percentile server read latency observed in the last hour
    </ResponseField>
  </Expandable>
</ResponseField>

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

    <ResponseField name="y" type="int">
      The average write latency value measured in the last hour
    </ResponseField>
  </Expandable>
</ResponseField>

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

    <ResponseField name="y" type="int">
      The 99th percentile server write latency observed in the last hour
    </ResponseField>
  </Expandable>
</ResponseField>

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

    <ResponseField name="y" type="int">
      Total number requests made to the database that are hit
    </ResponseField>
  </Expandable>
</ResponseField>

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

    <ResponseField name="y" type="int">
      Total number requests made to the database that are miss
    </ResponseField>
  </Expandable>
</ResponseField>

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

    <ResponseField name="y" type="int">
      Total number read requests made to the database
    </ResponseField>
  </Expandable>
</ResponseField>

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

    <ResponseField name="y" type="int">
      Total number write requests made to the database
    </ResponseField>
  </Expandable>
</ResponseField>

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

    <ResponseField name="y" type="int">
      Total number requests made to the database on the corresponding day
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="dailybandwidth" type="int">
  The total daily bandwidth usage (in bytes).
</ResponseField>

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

    <ResponseField name="y" type="int">
      The total bandwidth size for that specific timestamp
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="days" type="Array<string>">
  A list of the days of the week for the measurement
</ResponseField>

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

    <ResponseField name="y" type="int">
      The billing amount for that specific date.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="dailyproduce" type="int">
  Total number of daily produced commands
</ResponseField>

<ResponseField name="dailyconsume" type="int">
  Total number of daily consumed commands
</ResponseField>

<ResponseField name="total_monthly_requests" type="int">
  The total number of requests made in the current month.
</ResponseField>

<ResponseField name="total_monthly_read_requests" type="int">
  The total number of read requests made in the current month.
</ResponseField>

<ResponseField name="total_monthly_write_requests" type="int">
  The total number of write requests made in the current month.
</ResponseField>

<ResponseField name="total_monthly_storage" type="int">
  The total amount of storage used (in bytes) in the current month.
</ResponseField>

<ResponseField name="total_monthly_billing" type="int">
  Total cost of the database in the current month
</ResponseField>

<ResponseField name="total_monthly_produce" type="int">
  Total number of produce commands in the current month
</ResponseField>

<ResponseField name="total_monthly_consume" type="int">
  Total number of consume commands in the current month
</ResponseField>

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

  ```python Python
  import requests

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

  ```go Go
  client := &http.Client{}
  req, err := http.NewRequest("GET", "https://api.upstash.com/v2/redis/stats/: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
  {
    "connection_count": [
      {
        "x": "2023-05-22 10:59:23.426 +0000 UTC",
        "y": 320
      },
      ...
    ],
    "keyspace": [
      {
        "x": "2023-05-22 10:59:23.426 +0000 UTC",
        "y": 344725564
      },
      ...
    ],
    "throughput": [
      {
        "x": "2023-05-22 11:00:23.426 +0000 UTC",
        "y": 181.88333333333333
      },
      ...
    ],
    "produce_throughput": null,
    "consume_throughput": null,
    "diskusage": [
      {
        "x": "2023-05-22 10:59:23.426 +0000 UTC",
        "y": 532362818323
      },
      ...
    ],
    "latencymean": [
      {
        "x": "2023-05-22 10:59:23.426 +0000 UTC",
        "y": 0.176289
      },
      ...
    ],
    "read_latency_mean": [
      {
        "x": "2023-05-22 11:00:23.426 +0000 UTC",
        "y": 0
      },
      ...
    ],
    "read_latency_99": [
      {
        "x": "2023-05-22 11:00:23.426 +0000 UTC",
        "y": 0
      },
      ...
    ],
    "write_latency_mean": [
      {
        "x": "2023-05-22 11:00:23.426 +0000 UTC",
        "y": 0
      },
      ...
    ],
    "write_latency_99": [
      {
        "x": "2023-05-22 11:00:23.426 +0000 UTC",
        "y": 0
      },
      ...
    ],
    "hits": [
      {
        "x": "2023-05-22 11:00:23.426 +0000 UTC",
        "y": 0
      },
      ...
    ],
    "misses": [
      {
        "x": "2023-05-22 11:00:23.426 +0000 UTC",
        "y": 0
      },
      ...
    ],
    "read": [
      {
        "x": "2023-05-22 11:00:23.426 +0000 UTC",
        "y": 82.53333333333333
      },
      ...
    ],
    "write": [
      {
        "x": "2023-05-22 11:00:23.426 +0000 UTC",
        "y": 99.35
      },
      ...
    ],
    "dailyrequests": [
      {
        "x": "2023-05-18 11:58:23.534505371 +0000 UTC",
        "y": 68844080
      },
      ...
    ],
    "days": [
      "Thursday",
      "Friday",
      "Saturday",
      "Sunday",
      "Monday"
    ],
    "dailybilling": [
      {
        "x": "2023-05-18 11:58:23.534505371 +0000 UTC",
        "y": 145.72694911244588
      },
      ...
    ],
    "dailybandwidth": 50444740913,
    "bandwidths": [
      {
        "x": "2023-05-18 11:58:23.534505371 +0000 UTC",
        "y": 125391861729
      },
      ...
    ],
    "dailyproduce": null,
    "dailyconsume": null,
    "total_monthly_requests": 1283856937,
    "total_monthly_read_requests": 1034567002,
    "total_monthly_write_requests": 249289935,
    "total_monthly_storage": 445942383672,
    "total_monthly_billing": 222.33902763855485,
    "total_monthly_produce": 0,
    "total_monthly_consume": 0
  }
  ```
</ResponseExample>
