# Get database metrics

`GET https://api.instacloud.com/projects/{projectId}/database/metrics`

**Token scope:** `account` · `org` · `project` — read-only tokens allowed.

Point-in-time DB metrics (connections, size, deadlocks, tuple churn, cache hit). Provider-specific; may wake a suspended database.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `branch` | query | `string` | no | branch name (default branch if omitted) |
| `group` | query | `string` | no | postgres service name (default: the sole postgres service) |
| `projectId` | path | `string` | yes |  |

## Response 200

Default Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `connections` | `object` | no |  |
| `connections.active` | `integer` | no |  |
| `connections.idle` | `integer` | no |  |
| `connections.total` | `integer` | no |  |
| `connections.max` | `integer` | no |  |
| `dbSizeBytes` | `number` | no |  |
| `deadlocks` | `number` | no |  |
| `tuples` | `object` | no |  |
| `tuples.inserted` | `integer` | no |  |
| `tuples.updated` | `integer` | no |  |
| `tuples.deleted` | `integer` | no |  |
| `cacheHitRatio` | `number` | no | 0..1; blks_hit/(blks_hit+blks_read). Omitted when unmeasurable (suspended instance or no cache traffic yet) |
| `state` | `string` | no | provider instance state (e.g. running/suspended) when known |
| `serverVersion` | `string` | no | postgres server version, e.g. "16.14", when measured |

## Response 400

Default Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | `string` | yes |  |

## Response 403

Default Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | `string` | yes |  |

## Response 404

Default Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | `string` | yes |  |

## Response 409

Default Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | `string` | yes |  |

## Response 502

Default Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | `string` | yes |  |
