---
title: "The p4 Clients roster in one SQL statement (#4365)"
method: GET
path: "/accountant/customers/roster-summary"
tags: ["Accountant Portal"]
---

# The p4 Clients roster in one SQL statement (#4365)

`GET /accountant/customers/roster-summary`

## Request

- Base URL: `https://api.medianfi.com/api/v1`
- URL: `https://api.medianfi.com/api/v1/accountant/customers/roster-summary`
- Auth: HTTP bearer

Every client the caller can see (a human super-admin: every client) whose client status is `test` or `active`, ordered by name, read in one SQL statement, plus the counts per status. `status` is the first rule that holds: `stopped` (the client's kill switch is on), `off` (Penny is not on for the client: no settings row, not enabled, not on the deployment allowlist, Penny off for the deployment, or a patient-data company), `blocked` (an open Inbox item in group `blocked`), `watch` (an open Inbox item older than 48 hours; a stand-in until a close due date and "waiting on client" exist), else `on_track`. `onboarding` (PG-p04-011, aligned with `#5105`'s `isClientOnboarding`) is true only for a `test` client with neither `onboarding_completed_at` nor `company_books_status.last_close_date`. `accountingBasis` (PG-p07-021) is `"cash"`, `"accrual"`, or `null` resolved in order from effective `company_statement_basis`, effective `company_book_basis`, `tax_settings.accounting_method`, and `companies.accounting_method`. `reviewer` (PG-p07-021) is `{ accountantId, name }` from the assigned close reviewer (`client_close_duties`, duty `reviewer`), else the earliest assigned accountant with role `reviewer`, or `null`. `pennyLiveActionTypes` and `pennyTotalActionTypes` (PG-p07-021) count live `agent_capability_states` out of `AGENT_CAPABILITIES.length` (6). `close` is the close target (the oldest ended open GL period) with its completed or skipped step rows over all its step rows, or null when nothing is to close. `openItems` counts open Inbox items (a snoozed item whose time has passed reads open); `next` is the open item ranked blocked, review, ready, then oldest. `owner` is the earliest primary assignee. `patientData` is null when the client has no Penny settings row. **#2587 p4:** `status` is deprecated for the screen; read `health`: the worst of the client's six functions and its close prep. The functions are the ones p7's Overview shows (`GET …/agent/functions`, its close_prep row left out; PG-p01-002, so Clients and the Overview never disagree; `none` counts as off); where that read is not wired, roster-details' Inbox-derived states (deprecated) (blocked over watch over on_track); off functions are ignored, and the client is `off` only when all six are off and it has no close prep. Where Penny does not run at the client (not enabled, not on the deployment allowlist, patient data not answered "no", a company Penny refuses), only the Penny-run functions read off (categorize, reconcile, revenue, bills, documents); bank_feeds and close prep keep their own states (PG-p01-002, Lead 11-19). With `health` read, `status` is `stopped` by the kill switch, else `stopped` by Penny's stops where Penny is on, else `health`. Penny's own stop is roster-details' `penny.mode`, not health. `closePrep` is the client's row on `GET /month-end-close/board` (its default month): steps before close day done of 6, open codes, blocked; its `health` is blocked when the board marks the client blocked, watch when not ready while the board is behind pace, else on_track. Null with no close target. `health` and `closePrep` are null when the functions read is not wired. `owner.userId` is the owner's user id (null for an accountant with no user). `lifecycle` (PG-p04-021 / PG-p04-011) is `inactive` when `client_status = inactive`, else `onboarding` when `onboarding` is true, else `active`. `?lifecycle=inactive` lists the caller's inactive clients instead, in the same row shape with `health` and `closePrep` null and `summary` counting that list; absent, the default list and its counts never include an inactive client (p13-003). Any other value is a 422. Display only: nothing is written. A signed-in person only: every API key is refused, the service token included (404).

## Query parameters

- `lifecycle` 'inactive'

## Response `200`

The roster and its counts

- object
  - `success` true, required
  - `data` object, required
    - `summary` object, required
      - `clients` integer, required
      - `onTrack` integer, required
      - `watch` integer, required
      - `blocked` integer, required
      - `off` integer, required
      - `stopped` integer, required
      - `onboarding` integer, required
      - `health` object, required
        - `onTrack` integer, required
        - `watch` integer, required
        - `blocked` integer, required
        - `off` integer, required
    - `clients` object[], required
      - `customerId` string, uuid, required
      - `name` string, required
      - `industry` string, nullable, required
      - `plan` string, nullable, required
      - `patientData` boolean, nullable, required
      - `onboarding` boolean, required
      - `lifecycle` 'active' | 'onboarding' | 'inactive', required
      - `accountingBasis` 'cash' | 'accrual' | 'null', nullable, required
      - `reviewer` object, nullable, required
        - `accountantId` string, uuid, required
        - `name` string, required
      - `pennyLiveActionTypes` integer, required
      - `pennyTotalActionTypes` integer, required
      - `status` 'on_track' | 'watch' | 'blocked' | 'off' | 'stopped', required: Deprecated (#2587 p4): read health.
      - `health` 'on_track' | 'watch' | 'blocked' | 'off' | 'null', nullable, required
      - `closePrep` object, nullable, required
        - `month` string, required
        - `state` 'closed' | 'ready' | 'not_ready', required
        - `done` integer, required
        - `total` integer, required
        - `openBefore` string[], required
        - `blocked` boolean, required
        - `health` 'on_track' | 'watch' | 'blocked', required
      - `close` object, nullable, required
        - `period` string, required
        - `done` integer, required
        - `total` integer, required
        - `locked` boolean, required
      - `openItems` integer, required
      - `next` object, nullable, required
        - `itemId` string, uuid, required
        - `title` string, required
        - `group` 'ready' | 'review' | 'blocked', required
      - `owner` object, nullable, required
        - `accountantId` string, uuid, required
        - `userId` string, uuid, nullable, required
        - `name` string, required
        - `initials` string, 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/customers/roster-summary/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)
