# createInboundShipment

## Overview

Creates an inbound shipment (an `InboundShipment`) from a confirmed purchase order — used both for the first receipt and for additional split/subsequent deliveries. The inbound shipment is created in DRAFT status. Every receipt line must reference a purchase-order line: inbound-shipment lines carry the source-document link at the line level (`sourceDocumentType = PURCHASE_ORDER`, `sourceDocumentId = <PO id>`, `sourceLineId = <PO line id>`, all required), so manual / non-PO receipts are not supported.

The input uses `supplierAccountId` for the supplier account. Like `companyId`, it is informational; the shipment is linked through its purchase-order lines.

## Modules Commands Used

- [inbound-shipment] CreateInboundShipment

## Exception Handling

| Error Code | Description |
| --- | --- |
| INBOUND_SHIPMENT_EMPTY_SHIPMENT_LINES | No receipt lines were provided in the request. |
| INBOUND_SHIPMENT_INVALID_QUANTITY | The received quantity is invalid (e.g., zero or negative). |
| INBOUND_SHIPMENT_ITEM_NOT_FOUND | A referenced item does not exist. |
| INBOUND_SHIPMENT_STORAGE_LOCATION_NOT_FOUND | The specified storage location does not exist. |
| INBOUND_SHIPMENT_PRIMARY_UNIT_MISMATCH | A line unit does not match the item's primary unit. |
| INBOUND_SHIPMENT_INVALID_UNIT_CONVERSION_RATE | The unit conversion rate is invalid. |
| INSUFFICIENT_PERMISSION | The caller does not have permission to perform this operation |
