Get a PostgreSQL instance's metrics

Get each member's transactions, writes, connections, cache hit ratio, disk use and replication lag over time. Defaults to the last day. A range can be at most 366 days.

GET https://{availability_zone}.betterstackcloud.com/v1/postgres/{id}/metrics
id string required

The ID of the PostgreSQL instance.

from datetime

The start of the range. Defaults to one day before to. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

to datetime

The end of the range. Defaults to now. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

Authorization string required

Bearer $TOKEN

200 OK
{
  "postgres_id": "123456789",
  "postgres_name": "Example",
  "from": "2026-07-01T12:00:00.000Z",
  "to": "2026-07-01T12:00:00.000Z",
  "resolution": "raw",
  "members": [
    {
      "member_id": "123456789",
      "role": "primary",
      "data": [
        {
          "dt": "2026-07-01T12:00:00.000Z",
          "transactions_per_second": 1.5,
          "writes_per_second": 1.5,
          "connections": {
            "direct": 1.5,
            "direct_max": 1,
            "pooled": 1.5,
            "pooled_max": 1,
            "max_connections": 1,
            "max_pooled_connections": 1
          },
          "cache_hit_ratio": 1.5,
          "disk": {
            "used_bytes": 1,
            "used_bytes_max": 1,
            "usable_bytes": 1
          },
          "replication_lag_seconds": 1.5
        }
      ]
    }
  ]
}

Returns each member's metrics over time.

postgres_id string

The instance's ID.

postgres_name string

The instance's name.

from datetime

The start of the range returned. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

to datetime

The end of the range returned. In ISO 8601 format, such as 2026-07-01T12:00:00Z.

resolution string

How far apart the points are.
Valid values:
raw: One point per minute, for a range of up to one day.
hourly: One point per hour, for a longer range.

members array of objects

Each member's metrics over time. Every point has the transaction and write rates, the direct and pooled connections, the cache hit ratio, the disk use and the replication lag.

members[].member_id string

The member id.

members[].role string

Whether the member is the primary or a replica.
Valid values:
primary: The member that accepts writes.
replica: A read-only copy that follows the primary.

members[].data array of objects

The data.

members[].data[].dt datetime

In ISO 8601 format, such as 2026-07-01T12:00:00Z.

members[].data[].transactions_per_second number

The transactions per second.

members[].data[].writes_per_second number

The writes per second.

members[].data[].connections object

The connections.

members[].data[].connections.direct number

The direct.

members[].data[].connections.direct_max integer

The direct max.

members[].data[].connections.pooled number

The pooled.

members[].data[].connections.pooled_max integer

The pooled max.

members[].data[].connections.max_connections integer

The max connections.

members[].data[].connections.max_pooled_connections integer

The max pooled connections.

members[].data[].cache_hit_ratio number

The cache hit ratio.

members[].data[].disk object

The disk.

members[].data[].disk.used_bytes integer

The used bytes.

members[].data[].disk.used_bytes_max integer

The used bytes max.

members[].data[].disk.usable_bytes integer

The usable bytes.

members[].data[].replication_lag_seconds number

The replication lag seconds.