# Serial Numbers

Group: Inventory

[Open in the interactive reference](https://docs.api.lensing.ai/lensing/v1/groups/inventorySerialNumbers)

A serial number identifies one physical unit of an item and records its stock and cost.

A serial number record is one unit of an item, identified by its serial number.

Serial number records are created by these documents:

- A receipt or inventory increase, when it is saved with a new serial number. The serial number record's `inStock` is 0 until the document is committed.
- An inventory count, when it records a unit that has no serial number record.
- A production order, for the units it produces, when the order is released.
- A warehouse transfer between legal entities, in the receiving legal entity. The serial number record in the sending legal entity is kept. The unit comes into the receiving legal entity at the transfer price. The transfer price is the transfer line's total in the receiving legal entity's functional currency, divided by the line's quantity in the item's stocking unit.

A serial number record is not deleted when its unit leaves stock. After a shipment, for example, the serial number record has `inStock` 0 and `isSold` true.

If the unit comes back later, the same serial number record is used again. What happens to its cost depends on how the unit comes back:

- Returned: a customer sends the unit back on a sales return, or you cancel the shipment. The unit's `originalCost` does not change. A sales return also sets `isSold` back to false.
- Received as new stock: you buy the unit back on a receipt, for example as a trade-in, or you find a unit you wrote off and add it back with an inventory increase. The unit's `originalCost` is set to the cost on that document, `afterSaleCost` is cleared, and `isSold` becomes false.

Serial number records cannot be deleted. To take a unit out of use, set `active` to false with PATCH inventory/serial-numbers/:id. You cannot change a unit's `cost`, `originalCost`, `afterSaleCost`, `inStock`, `isSold`, or `locationId` with PATCH. Documents that move or revalue stock, such as receipts, shipments, warehouse transfers, and inventory revaluations, change these fields.

In the application, a unit whose `active` is false is not offered for picking. Documents created through the API do not check `active`, so check it yourself before you name a unit on a shipment or other outbound document.

A unit has its own `cost` and `originalCost` only when its item's `valuationMethod` is 'serials'. See `valuationMethod` on GET inventory/items/:id (getItem).

## Endpoints

- [List serial numbers](https://docs.api.lensing.ai/reference/lensing/v1/endpoints/serialNumbers.html): `GET /inventory/serial-numbers`
- [Search serial numbers](https://docs.api.lensing.ai/reference/lensing/v1/endpoints/searchSerialNumbers.html): `POST /inventory/serial-numbers/search`
- [Retrieve a serial number](https://docs.api.lensing.ai/reference/lensing/v1/endpoints/getSerialNumber.html): `GET /inventory/serial-numbers/{id}`
- [Update a serial number](https://docs.api.lensing.ai/reference/lensing/v1/endpoints/updateSerialNumber.html): `PATCH /inventory/serial-numbers/{id}`
