---
title: "Get database consumption metrics"
method: GET
path: "/projects/{id}/databases/{databaseName}/stats"
tags: ["Databases"]
---

# Get database consumption metrics

`GET /projects/{id}/databases/{databaseName}/stats`

## Request

- Base URL: `https://api.volcano.dev`
- URL: `https://api.volcano.dev/projects/{id}/databases/{databaseName}/stats`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Retrieve consumption metrics including storage, compute time, and data transfer.
Metrics are aggregated at the project level. Defaults to last 24 hours.

**Note:** Advanced metrics require an upgraded plan.

## Path parameters

- `id` string, uuid, required
- `databaseName` string, required

## Query parameters

- `from` string, date-time
- `to` string, date-time
- `granularity` 'hourly' | 'daily' | 'monthly'

## Response `200`

Successful response

- DatabaseStats
  - `current_storage_bytes` integer, required: On-disk size right now, in bytes: the database itself, plus every branch's divergence from it, plus what its backups cost to hold. This is the figure the storage allowance is enforced against. `branches` and `backup_storage_bytes` break it down.
  - `current_storage_mb` number, double, required: `current_storage_bytes` expressed in megabytes.
  - `branches` DatabaseBranchStorage[]: Per-branch contribution to `current_storage_bytes`. Empty when the database has no branches. A branch that has not diverged from its parent contributes nothing.
    - `id` string, uuid, required
    - `name` string, required: Branch name
    - `storage_bytes` integer, required: Bytes this branch has diverged from its parent. Pages the branch still shares with the parent are not counted, so this is what the branch actually adds to the total rather than its apparent size.
  - `backup_storage_bytes` integer, required: What this database's backups contribute to `current_storage_bytes`. A backup taken on request is charged as a full copy of the database as it was at that moment, so two backups of a 2 GB database are 4 GB. A backup schedule is charged its first snapshot in full and each later one only for the storage it adds. Deleting a backup releases its storage immediately. Sampled from the provider rather than measured live, so it can lag a change by a few minutes, and a backup taken seconds ago may not be costed yet. Zero on a plan without backups.
  - `storage_bytes` integer, required: Total storage used in bytes (data + WAL)
  - `data_written_bytes` integer, required: Total data written in bytes
  - `data_transfer_bytes` integer, required: Total data transferred in bytes
  - `compute_time_seconds` number, double, required: Total CPU seconds consumed
  - `active_time_seconds` number, double, required: Total active compute time in seconds
  - `time_range` string: Time range of the metrics (e.g., "2024-01-01T00:00:00Z to 2024-01-02T00:00:00Z")
  - `granularity` 'hourly' | 'daily' | 'monthly': Granularity of the aggregated metrics

## Other responses

- `400`: Invalid parameters
- `404`: Database not found
- `503`: Database metrics not available or requires upgraded plan

## Changes

- **2026-10-07** `23e7875e7c4c`: 1 info
  - the endpoint scheme security `ProjectAccessToken` was added to the API
- **2026-09-19** `3a6f365f3f35`: 6 breaking, 17 info
  - added the new path request parameter `databaseName`
  - added the new path request parameter `id`
  - the response's body type changed from no type to `object` for status `200`
  - the response's body type changed from no type to `object` for status `400`
  - …19 more
- **2026-08-27** `bb44e98aba2e`: 12 breaking, 7 warning
  - the response's body type changed from `object` to no type for status `200`
  - the response's body type changed from `object` to no type for status `400`
  - the response's body type changed from `object` to no type for status `404`
  - the response's body type changed from `object` to no type for status `503`
  - …15 more
- **2026-07-27** `bb52784e098a`: 3 info
  - added the optional property `code` to the response with the `400` status
  - added the optional property `code` to the response with the `404` status
  - added the optional property `code` to the response with the `503` status

[Operation history](https://skmtc.dev/kong/apis/volcano-api/changes/projects/:id/databases/:databaseName/stats/get.md)

---

[API](https://skmtc.dev/kong/apis/volcano-api.md) - [All operations](https://skmtc.dev/kong/apis/volcano-api/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/volcano-api/revisions/84c4488f91e9?raw)
