# List Batches

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

Returns all inventory batches, sorted by expiry date ascending (**FEFO** — First Expired, First Out). Batches with no expiry date are listed last.

### Query parameters

| Field | Type | Description |
|---|---|---|
| `listing_id` | integer | Filter by listing |
| `location_id` | integer | Filter by location |
| `expiring_before` | date | Filter to batches expiring on or before this date (ISO 8601: `YYYY-MM-DD`) |
| `active_only` | `1` | Only return batches with quantity > 0 |

### Response fields

| Field | Type | Description |
|---|---|---|
| `batches` | array | FEFO-sorted list of batch objects |

**Batch object**

| Field | Type | Description |
|---|---|---|
| `id` | integer | Batch ID |
| `listing_id` | integer | ID of the listing this batch belongs to |
| `location_id` | integer | ID of the location holding this batch |
| `lot_number` | string | Supplier lot/batch code (nullable) |
| `expiry_date` | date | Expiry date in `YYYY-MM-DD` format (nullable) |
| `quantity` | integer | Current stock quantity for this batch |
| `listing` | object | Associated listing (`id`, `sku`, `barcode`) |
| `location` | object | Associated location (`id`, `name`, `code`) |
