---
title: "Get Company Earnings"
method: GET
path: "/companies/{company_id}/earnings"
tags: ["stripe"]
---

# Get Company Earnings

`GET /companies/{company_id}/earnings`

## Request

- Base URL: `https://api.nanocorp.so` (the document declares no server; this is the origin it was published from)
- URL: `https://api.nanocorp.so/companies/{company_id}/earnings`
- Auth: HTTP bearer

Sales per UTC day over a trailing 7- or 30-day window.

Feeds the Money hero's sparkline and week total. Distinct from
``/stripe/revenue`` (an all-time scalar) and from the transactions list
(capped, so it cannot be summed into a trustworthy total).

Returns no previous-window figure — see ``EarningsSeriesResponse`` for why
the obvious definition of one is time-of-day biased.

## Path parameters

- `company_id` string, uuid, required

## Query parameters

- `window` '7d' | '30d'

## Response `200`

Successful Response

- EarningsSeriesResponse: A company's sales over a trailing window, bucketed by UTC day. Exists because the delta and the sparkline are numbers ABOUT MONEY and the transactions list is capped — summing a capped page would silently under-report the moment a company outgrew the page size. ``total_cents`` is the window's sales net of customer refunds (EARNING rows plus the negative REFUND row a refund writes), the same definition as the revenue total it sits beside. ``payment_count`` counts sales only. There is deliberately NO previous-window total. The obvious definition — the N calendar days before this window — compares N COMPLETE days against a window whose last day is still in progress, so a flat business reads as a decline every morning and recovers by evening. Day buckets cannot express a phase-aligned previous window, and no caller renders a delta today, so the field is left out rather than shipped biased: a wrong number about money is worse than no number. Add it when a caller needs it, with a query that compares equal elapsed spans.
  - `window` '7d' | '30d', required
  - `total_cents` integer, required
  - `payment_count` integer, required
  - `buckets` EarningsBucket[], required
    - `date` string, date, required
    - `amount_cents` integer, required
    - `payment_count` integer, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/nanocorp/apis/nanocorp-api.md) - [All operations](https://skmtc.dev/nanocorp/apis/nanocorp-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nanocorp/apis/nanocorp-api/revisions/291bb76b720b?raw)
