# GET /api/v1/bills/aging

> AP aging summary

- **Tag:** bills
- **Operation ID:** `get_bill_aging_api_v1_bills_aging_get`

## Description

Returns accounts payable aging data grouped by vendor with Current, 1-30, 31-60, 61-90, and 91+ day buckets. Includes per-bill detail for drill-down.

## Authentication

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

## Responses

### 200 — Successful Response

Schema: `BillAgingResponse`

- `as_of_date` (string · required) — Report date in YYYY-MM-DD format.
- `vendors` (array · AgingVendorSummary · required) → `AgingVendorSummary` — Per-vendor aging summary rows.
  - `vendor_id` (string)
  - `vendor_name` (string)
  - `current` (integer)
  - `days_1_30` (integer)
  - `days_31_60` (integer)
  - `days_61_90` (integer)
  - `days_91_plus` (integer)
  - `total` (integer)
- `bills` (array · AgingBillItem · required) → `AgingBillItem` — Individual bills with aging bucket for drill-down.
  - `id` (string · required)
  - `bill_number` (string)
  - `vendor_id` (string · required)
  - `vendor_name` (string)
  - `status` (string · required)
  - `amount` (integer · required) — Bill amount in cents.
  - `total_paid` (integer) — Total paid in cents.
  - `balance_due` (integer · required) — Remaining balance in cents.
  - `due_date` (string)
  - `days_past_due` (integer)
  - `bucket` (string · required) — Aging bucket: 'current', '1_30', '31_60', '61_90', '91_plus'.
- `totals` (AgingVendorSummary · required) → `AgingVendorSummary` — Grand totals across all vendors.
  - `vendor_id` (string)
  - `vendor_name` (string)
  - `current` (integer)
  - `days_1_30` (integer)
  - `days_31_60` (integer)
  - `days_61_90` (integer)
  - `days_91_plus` (integer)
  - `total` (integer)

### 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/bills/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/bills/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/bills/aging", headers=headers)
data = response.json()
```

## See also

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