# Expiring Batches

**GET** `/v1/inventory/batches/expiring`

Returns all active batches (quantity > 0) expiring within the next N days, sorted by expiry date ascending. Useful for triggering promotions, stock transfers, or alerts before stock expires.

### Query parameters

| Field | Type | Default | Description |
|---|---|---|---|
| `days` | integer | `90` | Return batches expiring within this many days |

### Response fields

| Field | Type | Description |
|---|---|---|
| `batches` | array | Expiring batches sorted by expiry date (soonest first) |
| `days_threshold` | integer | The `days` value used for this query |

**Batch object**

| Field | Type | Description |
|---|---|---|
| `id` | integer | Batch ID |
| `lot_number` | string | Supplier lot/batch code |
| `expiry_date` | date | Expiry date in `YYYY-MM-DD` format |
| `quantity` | integer | Current stock quantity |
| `listing` | object | Associated listing (`id`, `sku`, `barcode`) |
| `location` | object | Associated location (`id`, `name`, `code`) |

**Use cases:**
- US FDA rule: query `?days=90` to find batches that need promotions started
- Transfer near-expiry stock from warehouse to store: use batch IDs from this response to create stock transfers
- Set up automated alerts for batches expiring within 30 days
