---
title: "Penny restart metrics R1-R11, foundations F1-F5 and A1, and the close metrics (#4358,"
method: GET
path: "/accountant/penny/health"
tags: ["Accountant Portal"]
---

# Penny restart metrics R1-R11, foundations F1-F5 and A1, and the close metrics (#4358,

`GET /accountant/penny/health`

## Request

- Base URL: `https://api.medianfi.com/api/v1`
- URL: `https://api.medianfi.com/api/v1/accountant/penny/health`
- Auth: HTTP bearer

The p15 health section. `metrics` is exactly R1 to R11 in order. Each counts, per state, the companies whose latest value is fresh by the registry's `staleAfterSeconds`; a company whose latest value (in the last 3 days) is older is counted in `companies.stale`, and decides the state (`no_data`) only when no company has a fresh value; it is never shown green. `state` is the worst over them (red, then no_data, then amber, then green), stale counting as no_data; a metric with no value at all is `no_data` with `computedAt` null. `reasons` lists up to 5 distinct reasons of fresh red and no_data values (codes and counts only, e.g. `no_run_within_26h`, `read_failed`, `no_source: ...`). `firm` is the latest fresh firm-wide value for firm-grain metrics (R2, R6), else null. `definition` is the metric's F1 registry row in force (lines, comparators, action on red, owner Augusto, backup Jacob, who approved the lines and when), or null if the registry has none. `foundations` is F1 to F5 and A1: F1 is in place when every restart metric has a registry row with approved lines; F2 when every restart metric has a fresh value; F5 when every live account on every Penny client has a source registry row and there is at least one Penny client (HM-87, migration 679; its counts are in `coverage`); F3 is in place when a monitor pass finished in the last 15 minutes and every company Penny holds recorded a heartbeat in the last 10; A1 when a monitor pass (which evaluates the alerts) finished in the last 15 minutes and the monitor's newest alert in 7 days reached a channel (`slack_sent`; an alert only recorded, or none, is not in place, HM-87); F4 answers `not_built`. Each metric's `history` is its 7-day strip (HM-86): the last 7 UTC days, oldest first and today last, each the worst state any company stored that day, or `none` with nothing stored. `interimKeys` lists the hand-minted service keys not revoked (HM-30), soonest to expire first, with their days to expiry; red under 2 days, expired, or with no expiry. Only their names are shown. A foundation with its own registry row (F3's heartbeat line) carries it as `definition`. `closeMetrics` are the nine November close metrics (plan 18.5), kept by hand until Phase 2 (`state: kept_by_hand`). Values are written by the Penny monitor job (`npm run penny:monitor`). Any signed-in accountant; no company is named. Every API key is refused, the service token included (404).

## Response `200`

Metric states, foundations and close metrics

- object
  - `success` true, required
  - `data` object, required
    - `metrics` object[], required
      - `id` 'R1' | 'R2' | 'R3' | 'R4' | 'R5' | 'R6' | 'R7' | 'R8' | 'R9' | 'R10' | 'R11', required
      - `state` 'green' | 'amber' | 'red' | 'no_data', required
      - `companies` object, required
        - `green` integer, required
        - `amber` integer, required
        - `red` integer, required
        - `no_data` integer, required
        - `stale` integer, required
      - `computedAt` string, date-time, nullable, required
      - `reasons` string[], required
      - `firm` object, nullable, required
        - `value` number, nullable, required
        - `state` 'green' | 'amber' | 'red' | 'no_data', required
        - `reason` string, nullable, required
      - `definition` PennyMetricDefinition, nullable, required: One row of the F1 Penny metric registry, version in force (migration 623). Green when the value compares to `greenLine` by `greenComparator`; red when it compares to `redLine` by `redComparator`; amber between. A version whose lines nobody approved yet is `proposed`, naming nobody.
        - `metricId` string, required
        - `version` integer, required
        - `part` 'restart' | 'foundation' | 'close', required
        - `name` string, required
        - `description` string, required
        - `unit` 'count' | 'minutes' | 'hours' | 'seconds' | 'percent' | 'state', required
        - `grain` 'company' | 'firm', required
        - `source` string, required
        - `queryRef` string, required
        - `greenComparator` 'lt' | 'lte' | 'null', nullable, required
        - `greenLine` number, nullable, required
        - `redComparator` 'gt' | 'gte' | 'null', nullable, required
        - `redLine` number, nullable, required
        - `greenText` string, required
        - `redText` string, required
        - `actionOnRed` string, required
        - `alerting` boolean, required
        - `computed` boolean, required: false for a metric kept by hand
        - `cadenceSeconds` integer, nullable, required
        - `staleAfterSeconds` integer, nullable, required
        - `owner` string, required
        - `backup` string, required
        - `approvalState` 'approved' | 'proposed', required
        - `linesApprovedBy` string, nullable, required
        - `linesApprovedOn` string, date, nullable, required
        - `approvalRef` string, required
      - `history` object[], required: HM-86. The last 7 UTC days, oldest first, today last.
        - `day` string, date, required
        - `state` 'green' | 'amber' | 'red' | 'no_data' | 'none', required
        - `values` integer, required: How many values were stored that day.
    - `foundations` object[], required
      - `id` 'F1' | 'F2' | 'F3' | 'F4' | 'F5' | 'A1', required
      - `inPlace` boolean, required
      - `check` string, required
      - `definition` PennyMetricDefinition: One row of the F1 Penny metric registry, version in force (migration 623). Green when the value compares to `greenLine` by `greenComparator`; red when it compares to `redLine` by `redComparator`; amber between. A version whose lines nobody approved yet is `proposed`, naming nobody.
        - `metricId` string, required
        - `version` integer, required
        - `part` 'restart' | 'foundation' | 'close', required
        - `name` string, required
        - `description` string, required
        - `unit` 'count' | 'minutes' | 'hours' | 'seconds' | 'percent' | 'state', required
        - `grain` 'company' | 'firm', required
        - `source` string, required
        - `queryRef` string, required
        - `greenComparator` 'lt' | 'lte' | 'null', nullable, required
        - `greenLine` number, nullable, required
        - `redComparator` 'gt' | 'gte' | 'null', nullable, required
        - `redLine` number, nullable, required
        - `greenText` string, required
        - `redText` string, required
        - `actionOnRed` string, required
        - `alerting` boolean, required
        - `computed` boolean, required: false for a metric kept by hand
        - `cadenceSeconds` integer, nullable, required
        - `staleAfterSeconds` integer, nullable, required
        - `owner` string, required
        - `backup` string, required
        - `approvalState` 'approved' | 'proposed', required
        - `linesApprovedBy` string, nullable, required
        - `linesApprovedOn` string, date, nullable, required
        - `approvalRef` string, required
      - `coverage` object: F5 only. Penny clients (Penny enabled), their live accounts, and how many have no source registry row. Counts only.
        - `pennyClients` integer, required
        - `accounts` integer, required
        - `missing` integer, required
    - `closeMetrics` intersection[], required
      - intersection
        - [`PennyMetricDefinition`](https://skmtc.dev/medianfi/apis/median-api/revisions/4f4c2d34276b/schema?at=%2Fcomponents%2Fschemas%2FPennyMetricDefinition)
        - object
          - `state` 'kept_by_hand', required
    - `monitor` object, required: F3. The newest finished monitor pass; `silent` once it is over 15 minutes old (or none).
      - `lastRunAt` string, date-time, nullable, required
      - `silent` boolean, required
    - `heartbeats` object, required: F3. Companies Penny holds (enabled, not stopped, not patient-data) and how many recorded a heartbeat in the last 10 minutes.
      - `held` integer, required
      - `beating` integer, required
      - `newestAt` string, date-time, nullable, required
    - `alerts` object, required: A1. `open` is each open alert's newest message; `recent` every message of the last 7 days, newest first (at most 200). One alert per metric (`MONITOR` for the monitor gone silent, raised by the API's own watch). Companies are counted, never named.
      - `open` PennyAlertMessage[], required
        - `alertKey` string, required
        - `event` 'open' | 'repeat' | 'escalate' | 'close', required
        - `recipient` 'owner' | 'backup', required: owner: Augusto; backup: Jacob (still open after 30 minutes)
        - `metricId` string, required
        - `companies` integer, required
        - `value` number, nullable, required
        - `redLine` number, nullable, required
        - `redSince` string, date-time, nullable, required
        - `delivery` 'recorded_only' | 'slack_sent' | 'slack_failed', required
        - `source` 'monitor' | 'api_watch', required
        - `at` string, date-time, required
      - `recent` PennyAlertMessage[], required
        - `alertKey` string, required
        - `event` 'open' | 'repeat' | 'escalate' | 'close', required
        - `recipient` 'owner' | 'backup', required: owner: Augusto; backup: Jacob (still open after 30 minutes)
        - `metricId` string, required
        - `companies` integer, required
        - `value` number, nullable, required
        - `redLine` number, nullable, required
        - `redSince` string, date-time, nullable, required
        - `delivery` 'recorded_only' | 'slack_sent' | 'slack_failed', required
        - `source` 'monitor' | 'api_watch', required
        - `at` string, date-time, required
    - `interimKeys` object[], required: HM-30. Hand-minted service keys not revoked, soonest to expire first; names only.
      - `name` string, required
      - `expiresAt` string, date-time, nullable, required
      - `daysLeft` number, nullable, required: Days left rounded down to one decimal; negative once expired; null with no expiry.
      - `state` 'green' | 'red', required

## Other responses

- `401`: Authentication required
- `403`: Insufficient permissions or not a company member
- `404`: Resource not found

## Changes

- **2026-11-26** `4a2098becaf9`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/medianfi/apis/median-api/changes/accountant/penny/health/get.md)

---

[API](https://skmtc.dev/medianfi/apis/median-api.md) - [All operations](https://skmtc.dev/medianfi/apis/median-api/llms.txt) - [OpenAPI document](https://skmtc.dev/medianfi/apis/median-api/revisions/4f4c2d34276b?raw)
