# Batch Numbers

Group: Inventory

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

A batch number identifies stock of one item that shares an expiry date, a cost, and a quality-control status.

A batch is a quantity of one item, in one warehouse, that shares one batch number. The same batch number on another item or in another warehouse is a separate batch.

Batches are created by these documents:

- A receipt or inventory increase, when it is saved with a batch number that the item does not yet have in that warehouse. The batch's `quantity` stays 0 until the document is committed. A later receipt or inventory increase with the same batch number, item, and warehouse adds to the same batch.
- An inventory count, when it is saved with a batch number that the item does not yet have in that warehouse. The batch's `quantity` stays 0 until the inventory increase that the count creates for a surplus is committed.
- A production order, for what it produces, when the order is released.
- A warehouse transfer, when it is committed, if the receiving warehouse does not already have a batch with that number for the item. The new batch has the same number. Between legal entities, the new batch's cost is the transfer price, not the cost the stock had in the sending warehouse. 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.

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

A batch is blocked while any of these apply:

- Its `batchStatus` is 'QUARANTINED', 'EXPIRED', or 'DISPOSED'.
- Its `qcStatus` has a value other than 'PASS'.
- Its `temperatureBreach` is true.

The application does not offer a blocked batch for picking, or a batch whose `active` is false. Committing a shipment with POST inventory/shipments/:id/commit fails if a line names a blocked batch. Inventory decreases, warehouse transfers, and purchase returns do not check these values. The stock stays in inventory either way, and a past `expirationDate` alone does not block a batch.

## Endpoints

- [List batch numbers](https://docs.api.lensing.ai/reference/lensing/v1/endpoints/batchNumbers.html): `GET /inventory/batch-numbers`
- [Search batch numbers](https://docs.api.lensing.ai/reference/lensing/v1/endpoints/searchBatchNumbers.html): `POST /inventory/batch-numbers/search`
- [Retrieve a batch number](https://docs.api.lensing.ai/reference/lensing/v1/endpoints/getBatchNumber.html): `GET /inventory/batch-numbers/{id}`
- [Update a batch number](https://docs.api.lensing.ai/reference/lensing/v1/endpoints/updateBatchNumber.html): `PATCH /inventory/batch-numbers/{id}`
