# GET /api/v1/inventory/lots/expiring

> List expiring cost lots

- **Tag:** inventory:lots
- **Operation ID:** `list_expiring_lots_api_v1_inventory_lots_expiring_get`

## Description

Return non-exhausted cost lots with an `expiration_date` within the next `within_days` days. Powers the 'Expiring soon' badge on the inventory overview.

## Authentication

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

## Parameters

- `within_days` (query, integer, optional) — Lookahead window in days (default 30).
- `include_expired` (query, boolean, optional) — When false, exclude lots whose `expiration_date` is already in the past.
- `limit` (query, integer, optional)

## Responses

### 200 — Successful Response

Schema: `ExpiringLotsResponse`

- `within_days` (integer · required)
- `lots` (array · ExpiringLot) → `ExpiringLot`
  - `id` (string · required)
  - `variant_id` (string)
  - `variant_name` (string)
  - `sku` (string)
  - `product_name` (string)
  - `lot_number` (string)
  - `external_lot_id` (string)
  - `expiration_date` (string · date)
  - `days_until_expiry` (integer) — Days from today to `expiration_date` (negative when already expired).
  - `quantity_remaining` (number · required)
  - `unit_cost_cents` (integer · required)
- `total_remaining_value_cents` (integer)

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 422 — Validation Error - Invalid data format

## Code samples

### cURL

```bash
curl -X GET 'https://api.ondayzero.com/api/v1/inventory/lots/expiring' \
  -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/lots/expiring', {
  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/lots/expiring", headers=headers)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/inventory-lots/list-expiring-lots
- OpenAPI slice: https://www.ondayzero.com/docs/reference/inventory-lots/list-expiring-lots/openapi.json
- Other endpoints in **inventory:lots**: https://www.ondayzero.com/docs/reference/inventory-lots
