# Creates a bin.

`POST /inventory/bins`

Group: Inventory › Bins · Operation ID: `createBin`

A warehouse must be given its bins before any stock moves in it. Once it has inventory transactions that recorded no bin, its first bin is refused with WAREHOUSE_NOT_BIN_TRACKABLE and the warehouse can never become bin-tracked. A warehouse that already has one bin can always have more. Only binCode and locationId are required. The response is the created bin's id and code.

[Open in the interactive reference](https://docs.api.lensing.ai/?op=createBin)

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Api-Version` | header | `"v1"` | yes | The API version this request targets, named by its public identifier. Required on every request; omitting it, or naming a version this company does not have, is answered with 400. This document describes version `v1`. |
| `Idempotency-Key` | header | string | no | An opaque caller-chosen string (1-255 characters) that makes this request safe to retry. Repeating the same key with an identical request body replays the original response instead of re-executing - but only once that original request succeeded; a failed attempt re-executes on retry. Repeating the key with a different body is answered with 422. A key still in flight is answered with 409 - as is a key whose original request was interrupted before it finished, for a few minutes afterwards, until that attempt is presumed dead. A completed response stays replayable for 24 hours. The key is scoped to the caller, not to the action: reusing it for a different action is answered with 409 or 422 rather than treated independently. On read actions this header is ignored. On write actions that cannot offer the guarantee it is answered with `400 IDEMPOTENCY_NOT_SUPPORTED` rather than silently ignored. |

## Request body

Required, `application/json`: createBinInput.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `binCode` | string | yes | The short code that identifies the bin, for example 'A-01-1'. Required. It is unique within the tenant, not per warehouse, and cannot be changed after the bin is created. |
| `locationId` | string | yes | The unique identifier for the warehouse the bin is in. Required. It cannot be changed after the bin is created. See id on GET inventory/warehouses/:id. |
| `barcode` | string | no | The barcode printed on the bin label. It is unique within the tenant and cannot be changed after the bin is created. |
| `aisle` | string | no | The aisle in the warehouse layout. |
| `rack` | string | no | The rack within the aisle. |
| `shelfLevel` | string | no | The shelf level within the rack. |
| `zone` | string | no | The logical zone of the bin, as your tenant names them. For example 'Picking', 'Storage' or 'Quarantine'. |
| `itemPosition` | string | no | The position within the shelf, where a bin is subdivided further. |
| `isPickingBin` | boolean | no | Whether the bin is a picking location, a fast-access place stock is taken from to fulfill shipments. |
| `isReceivingBin` | boolean | no | Whether the bin stages newly received goods before they are put away. |
| `isProductionBin` | boolean | no | Whether the bin feeds or receives production. |
| `maxQuantity` | number | no | The largest number of units the bin will hold. It is meaningful only when everything in the bin is counted in the same unit. |
| `maxWeight` | string (decimal) | no | The largest weight the bin will hold, in maxWeightUnit. Send it together with maxWeightUnit. A limit given without its unit is read as no limit, so the bin would accept any weight. |
| `maxWeightUnit` | string | no | The unit maxWeight is given in. Accepted values: 'G', 'Kg', 'Lbs'. Send it together with maxWeight, or leave both out. |
| `maxVolume` | string (decimal) | no | The largest volume the bin will hold, in maxVolumeUnit. Send it together with maxVolumeUnit. A limit given without its unit is read as no limit. |
| `maxVolumeUnit` | string | no | The unit maxVolume is given in. Accepted values: 'L'. Send it together with maxVolume, or leave both out. |
| `capacityCheckMode` | string | no | What happens when a movement would exceed a limit. Accepted values: 'HardBlock', which refuses the movement, and 'SoftWarning', which allows it and flags it. |
| `tempZone` | string | no | The temperature zone the bin belongs to, as your tenant names them. For example 'Ambient', 'Chilled' or 'Frozen'. |
| `tempMin` | string (decimal) | no | The lowest temperature kept in the bin, in degrees Celsius. It must not be above tempMax. |
| `tempMax` | string (decimal) | no | The highest temperature kept in the bin, in degrees Celsius. |
| `supportsPerishable` | boolean | no | Whether perishable stock may be kept in the bin. |
| `active` | boolean | no | Whether the bin may be chosen for new movements. Defaults to true. |

Example:

```json
{
  "binCode": "A-01-1",
  "locationId": "f5272ae0-0f0b-47d2-b78a-2158fec2cc32",
  "barcode": "<barcode>",
  "aisle": "A",
  "rack": "01",
  "shelfLevel": "1",
  "zone": "Picking",
  "itemPosition": "<itemPosition>",
  "isPickingBin": true,
  "isReceivingBin": true,
  "isProductionBin": true,
  "maxQuantity": 0,
  "maxWeight": "250",
  "maxWeightUnit": "Kg",
  "maxVolume": "19.99",
  "maxVolumeUnit": "<maxVolumeUnit>",
  "capacityCheckMode": "HardBlock",
  "tempZone": "<tempZone>",
  "tempMin": "19.99",
  "tempMax": "19.99",
  "supportsPerishable": true,
  "active": true
}
```

## Response

`200` Success

Under `data` (createBinOutput):

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | The unique identifier for the created bin. |
| `binCode` | string | no | The bin's code. |

## Response headers

- `Idempotency-Replayed` — Present and `true` only when this response replays a previously stored one for the same Idempotency-Key, rather than reflecting a live execution. Absent on a live response - never sent as `false`.

## Errors

| Code | Status |
| --- | --- |
| `REFERENCE_NOT_FOUND` | 400 |
| `DUPLICATE_CODE` | 400 |
| `WAREHOUSE_NOT_BIN_TRACKABLE` | 400 |
| `UNKNOWN_VALUE` | 400 |
| `INCOMPLETE_LIMIT` | 400 |
| `INVALID_RANGE` | 400 |
| `IDEMPOTENCY_KEY_CONFLICT` | 409 |
| `IDEMPOTENCY_PAYLOAD_MISMATCH` | 422 |

## Statuses

- `400` — Invalid request or business failure. Codes: REFERENCE_NOT_FOUND, DUPLICATE_CODE, WAREHOUSE_NOT_BIN_TRACKABLE, UNKNOWN_VALUE, INCOMPLETE_LIMIT, INVALID_RANGE
- `401` — Missing or invalid access token
- `403` — Not authorized
- `404` — Not found
- `409` — The Idempotency-Key is still being processed by another request.
- `422` — The Idempotency-Key was already used with a different request payload.
- `429` — Too many requests
- `500` — Internal server error
