# GET /api/v1/inventory/reports/aging

> Inventory aging report

- **Tag:** inventory:reports
- **Operation ID:** `get_aging_api_v1_inventory_reports_aging_get`

## Description

Bucket remaining cost-lot quantities (and dollars) by lot age (0-30 / 31-60 / 61-90 / 91-180 / 180+ days). Optionally returns the per-variant detail with the oldest received_at.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Parameters

- `detail` (query, boolean, optional) — Include per-variant breakdown sorted by oldest lot age.
- `detail_limit` (query, integer, optional) — Cap on per-variant detail rows when `detail=true`.

## Responses

### 200 — Successful Response

Schema: `AgingResponse`

- `total_value_cents` (integer)
- `total_on_hand_units` (number)
- `buckets` (array · AgingBucket) → `AgingBucket`
  - `bucket` (string · required) — Aging band: 0-30 / 31-60 / 61-90 / 91-180 / 180+.
  - `on_hand_units` (number · required)
  - `total_value_cents` (integer · required)
  - `lot_count` (integer · required)
- `variants` (array · AgingVariantRow) → `AgingVariantRow`
  - `variant_id` (string · required)
  - `variant_name` (string)
  - `sku` (string)
  - `product_name` (string)
  - `oldest_received_at` (string · date-time)
  - `days_oldest` (integer)
  - `on_hand_units` (number · required)
  - `total_value_cents` (integer · required)

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X GET 'https://api.ondayzero.com/api/v1/inventory/reports/aging' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/inventory/reports/aging', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
  },
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

response = httpx.get("https://api.ondayzero.com/api/v1/inventory/reports/aging", headers=headers)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/inventory-reports/get-aging
- OpenAPI slice: https://www.ondayzero.com/docs/reference/inventory-reports/get-aging/openapi.json
- Other endpoints in **inventory:reports**: https://www.ondayzero.com/docs/reference/inventory-reports
