# Receive Purchase Order

**POST** `/v1/inventory/purchase-orders/:po_id/receive`

Records received stock against a PO's line items. Supports **partial receiving** — you can receive part of an order and come back to receive the rest later. The PO status updates automatically:

- Any item received → `partial`
- All items fully received → `received`

Each receive creates a `receive` movement in the inventory ledger. If you supply `lot_number` or `expiry_date` per item, the system creates or increments the corresponding batch at the PO's receiving location — preserving lot traceability.

### Path parameters

| Field | Type | Description |
|---|---|---|
| `po_id` | integer | ID of the purchase order |

### Request fields

| Field | Type | Required | Description |
|---|---|---|---|
| `items` | array | Yes | Items to receive (min 1) |
| `items[].item_id` | integer | Yes | PO line item ID |
| `items[].quantity_received` | integer | Yes | Units received in this delivery |
| `items[].lot_number` | string | No | Lot/batch number from supplier label |
| `items[].expiry_date` | date | No | Expiry date in `YYYY-MM-DD` format |

> If `quantity_received` exceeds the remaining quantity on a line item, it is clamped to the remaining amount automatically.

### Response fields

| Field | Type | Description |
|---|---|---|
| `purchase_order` | object | Updated PO with revised `quantity_received` per item and updated status |

**Example — partial receive with lot traceability:**
```json
{
  "items": [
    {
      "item_id": 12,
      "quantity_received": 50,
      "lot_number": "LOT-2026-A",
      "expiry_date": "2027-03-01"
    },
    {
      "item_id": 13,
      "quantity_received": 100,
      "lot_number": "LOT-2026-B",
      "expiry_date": "2027-06-15"
    }
  ]
}
```
