---
title: "Per-member health for a Postgres HA cluster."
method: GET
path: "/external-services/{id}/cluster-health"
tags: ["External Services"]
---

# Per-member health for a Postgres HA cluster.

`GET /external-services/{id}/cluster-health`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/external-services/{id}/cluster-health`
- Auth: HTTP bearer

Reads pg_auto_failover's `pgautofailover.node` table from the cluster's
monitor (TLS, autoctl_node) and joins each member with its
`pg_stat_replication` row from the current primary. Returns one row per
data member with role/state, sync state, and replay lag.

Returns `200` with `monitor_error` set when the monitor is briefly
unreachable (UI surfaces it as a banner above the table); the table
itself is empty in that case. Returns `400` for non-cluster services.

## Path parameters

- `id` integer, required

## Response `200`

Per-member cluster health report

- ClusterHealthReportResponse: Response body for `GET /external-services/{id}/cluster-health`.
  - `checked_at` string, required: ISO-8601 wall-clock when the report was generated.
  - `members` ClusterMemberHealthResponse[], required
    - `candidate_priority` integer, required
    - `goal_state` string, required: What the monitor *wants* the node to be. Differs from `reported_state` mid-transition (failover, demotion, etc.).
    - `health` integer, required: pg_auto_failover liveness signal: `1` healthy, `0` unknown (no recent report), `-1` unhealthy.
    - `nodehost` string, required
    - `nodename` string, required
    - `nodeport` integer, required
    - `replay_lag_ms` integer, nullable: `replay_lag` from `pg_stat_replication`, in milliseconds.
    - `replication_quorum` boolean, required
    - `reported_state` string, required: What the node *last told the monitor* it was. Stale during outages.
    - `seconds_since_report` integer, required: Wall-clock seconds since the node last reported in.
    - `sync_state` string, nullable: `sync` / `quorum` / `async` for secondaries; `null` for the primary.
  - `monitor_error` string, nullable: Set when the monitor itself was unreachable. UI shows a banner.
  - `monitor_response_ms` integer, required: Round-trip to query the monitor (ms).
  - `protection` ClusterProtectionResponse, required: Whether a standby could take over if the primary failed now. A new cluster accepts SQL before its first standby is `secondary`; until then this is `not_protected`.
    - `detail` string, required: Names the protecting standby, or what is missing.
    - `state` 'protected' | 'not_protected' | 'unknown', required: `protected` once a healthy, promotable standby is `secondary`; `not_protected` while none is (none configured, the first one still copying the primary, or all unhealthy); `unknown` when the monitor could not be read.

## Other responses

- `400`: Service is not a cluster
- `401`: Unauthorized
- `404`: Service not found
- `500`: Internal server error

## Changes

- **2026-10-11** `1bfd419deb2f`: 1 info
  - added the required property `protection` to the response with the `200` status
- **2026-05-30** `b72341d12f63`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/external-services/:id/cluster-health/get.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
