> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uplink.build/llms.txt
> Use this file to discover all available pages before exploring further.

# uplink:AggregateStat

> A single scalar metric with an optional delta vs. a prior period. Generic across fitness, banking, payroll, streaming, and any other quantitative domain.

**`uplink:AggregateStat/v1`** — a single scalar metric with an optional delta vs. a comparable prior period. Deliberately generic: weekly totals, month-to-date, YTD, quarter-over-quarter, etc. across every quantitative domain.

## Fields

| Field | Type | Required | Description |
| - | - | - | - |
| `label` | string | ✓ | Human-readable name of the metric (e.g. `Total distance this week`, `Net pay YTD`, `Watched hours`). |
| `value` | number \| string | ✓ | The measurement. Numeric when quantitative; string when pre-formatted with unit (e.g. `$1,240.50`, `32.4 mi`). Consumers pick display style from the type. |
| `unit` | string | | Unit for `value` when it's numeric. Omit when `value` is already formatted. |
| `periodLabel` | string | | Human-friendly time window (e.g. `This week`, `Last 30 days`, `2026 YTD`). |
| `delta` | object | | Change vs. the comparable prior period. See below. |
| `breakdown` | array\<object> | | Optional detail rows for consumers that render a drill-down (e.g. mileage per activity type). |

### `delta` object

| Field | Type | Required | Description |
| - | - | - | - |
| `value` | number | ✓ | Magnitude of the change. |
| `direction` | string | ✓ | `up`, `down`, or `flat`. |
| `unit` | string | | Unit for the delta value. |
| `periodLabel` | string | | Prior period being compared against (e.g. `vs. last week`). |

### `breakdown[]` rows

| Field | Type | Required | Description |
| - | - | - | - |
| `label` | string | ✓ | Row label. |
| `value` | number \| string | ✓ | Row measurement. |
| `unit` | string | | Unit when value is numeric. |

## Example — pre-formatted string value

```json theme={null}
{
  "label": "This week on Strava",
  "value": "32.4 mi",
  "periodLabel": "This week",
  "delta": {
    "value": 4.2,
    "unit": "mi",
    "direction": "up",
    "periodLabel": "vs. last week"
  }
}
```

## Example — numeric value with breakdown

```json theme={null}
{
  "label": "Net pay YTD",
  "value": 63212,
  "unit": "USD",
  "periodLabel": "2026 YTD",
  "breakdown": [
    { "label": "Regular",  "value": 58200, "unit": "USD" },
    { "label": "Bonus",    "value":  5012, "unit": "USD" }
  ]
}
```

## Emitted by

* `@atomic/strava` — `stats` on `fetchAll` and `weekStats`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.