---
title: "Posted revenue grouped by invoiced customer"
method: GET
path: "/companies/{companyId}/metrics/revenue-by-client"
tags: ["Overview"]
---

# Posted revenue grouped by invoiced customer

`GET /companies/{companyId}/metrics/revenue-by-client`

## Request

- Base URL: `https://api.medianfi.com/api/v1`
- URL: `https://api.medianfi.com/api/v1/companies/{companyId}/metrics/revenue-by-client`
- Auth: HTTP bearer

Returns the Home "Revenue by client" card: POSTED revenue journal lines (closing entries excluded) grouped by the customer their invoice provenance actually names, resolved through the AR subledger. Revenue with no invoice-to-customer linkage (processor payouts, name-only invoices, unwired subledger) is summed into `otherCents` — never invented per client. Window is the last `months` complete months plus the current month-to-date; entity-scoped when `entityId` is given. `available` is false when the window holds no posted revenue lines.

## Query parameters

- `entityId` string, uuid
- `months` integer

## Response `200`

Revenue-by-client payload

- RevenueByClientResponse
  - `success` true, required
  - `data` RevenueByClientData, required
    - `available` boolean, required: False when the window holds no posted revenue lines (clients empty, otherCents 0).
    - `reason` 'mixed_currencies': Present only when available is false because the company-wide read spans entities in different functional currencies (banned before consolidation). Entity-scoped reads are single-currency and never carry this.
    - `basis` 'posted-invoices', required
    - `clients` RevenueByClientRow[], required: Descending by revenue, then name.
      - `customerId` string, uuid, required
      - `name` string, required
      - `revenueCents` integer, required: Posted revenue attributed to this customer over the window, in cents.
    - `otherCents` integer, required: Posted revenue with no invoice-to-customer provenance, in cents. Never guessed per client.

## Other responses

- `401`: Authentication required
- `403`: Insufficient permissions or not a company member
- `422`: Request failed validation
- `503`: The legal-entity scope authority could not be read

---

[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/20090ea32b0d?raw)
