> For the complete documentation index, see [llms.txt](https://doc.blowhorn.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.blowhorn.com/api-docs/wms-inventory/inventory.md).

# Inventory

## Fetch Inventories

<mark style="color:blue;">`GET`</mark> `/wms/inventory`

Use this interface to fetch a single or set of Inventory entries in for the client. This api result can be filtered to return a single or set based on various field level documented below. Result returned as response contains important informations like the sku name & number, location, quantity, allocated quantity, the client Tag, and other details.\
While creating a new inventory location, it initially has no inventory data associated with it. You can set inventory values for an SKU at the location.

#### Query Parameters

| Name                | Type   | Description                                                                                                                                                              |
| ------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| sku\_id             | String | Blowhorn assigned/supplied integer unique id for the SKU like 12345                                                                                                      |
| sku\_name           | String | Partial or full text matching name of the SKU like 'Wires'                                                                                                               |
| client\_id          | String | Warehouse Client id to which the item belongs.                                                                                                                           |
| client\_name        | String | Warehouse Client name like 'ABC Corp' either full or partial for search                                                                                                  |
| site\_id            | String | Warehouse site identifier which is numeric                                                                                                                               |
| site\_name          | String | Full or partial Warehouse site name for search.                                                                                                                          |
| mfg\_date\_start    | String | Date in the form of YYYY-MM-DD which indicates start filter which is inclusive to filter the result on manufactured date of the inventory.                               |
| mfg\_date\_end      | String | Date in the form of YYYY-MM-DD which indicates end filter which is inclusive to filter the result on manufactured date of the inventory.                                 |
| expiry\_date\_start | String | Date in the form of YYYY-MM-DD which indicates start filter which is inclusive to filter the result on expiry date of the inventory.                                     |
| expiry\_date\_end   | String | Date in the form of YYYY-MM-DD which indicates end filter which is inclusive to filter the result on expiry date of the inventory.                                       |
| tag                 | String | Full or partial tag value to filter the inventory result. If passed full value like \`TAG-1Y28W7L\` then result will be only one inventory returned matching to the tag. |

#### Headers

| Name                                       | Type   | Description                       |
| ------------------------------------------ | ------ | --------------------------------- |
| API\_KEY<mark style="color:red;">\*</mark> | string | Contact Blowhorn team for API Key |

{% tabs %}
{% tab title="401 Unauthorized/Validation Error" %}

```json
{
  "status": "FAIL",
  "message": "Unauthorized"
}
```

{% endtab %}

{% tab title="500 Unexpected error" %}

```json
{
  "status": "FAIL",
  "message": "Unexpected error"
}
```

{% endtab %}

{% tab title="200: OK Response for no search criteria or no matching criteria" %}

```javascript
{
    "count": 11,
    "previous": null,
    "next": 0,
    "result": [
        {
            "id": 70563,
            "sku_name": "Cannon Digital Camera",
            "location_name": "Default Client-7",
            "client_name": "Default Client",
            "site_name": "Koramangala WH",
            "uom": "g",
            "created_date": "2022-04-22T20:43:16.007483+05:30",
            "modified_date": "2022-04-22T20:43:16.017089+05:30",
            "tag": "TAG-224R308",
            "tracking_level": "Each",
            "qty": 15,
            "allocated_qty": 0,
            "status": "UnLocked",
            "weight": "2700.00",
            "expiry_date": "2023-01-22T05:30:00+05:30",
            "mfg_date": "2022-04-17T05:30:00+05:30",
            "remarks": null,
            "created_by": 109093,
            "modified_by": 109093,
            "sku": 89,
            "location": 6,
            "site": 7,
            "pack_config": 6,
            "client": 4,
            "container": null,
            "dimensions": null,
            "supplier": 4
        },
        {
            "id": 67823,
            "sku_name": "Cannon Digital Camera 55-200 lens",
            "location_name": "Default Client-7",
            "client_name": "Default Client",
            "site_name": "Koramangala WH",
            "uom": "g",
            "created_date": "2022-04-15T20:15:59.941605+05:30",
            "modified_date": "2022-04-26T09:12:06.165728+05:30",
            "tag": "TAG-21XHAI9",
            "tracking_level": "Each",
            "qty": 1,
            "allocated_qty": 0,
            "status": "UnLocked",
            "weight": "2700.00",
            "expiry_date": "2022-12-15T05:30:00+05:30",
            "mfg_date": "2022-04-10T05:30:00+05:30",
            "remarks": null,
            "is_shopify_synced": true,
            "created_by": 109093,
            "modified_by": null,
            "sku": 89,
            "location": 6,
            "site": 7,
            "pack_config": 6,
            "client": 4,
            "container": null,
            "dimensions": null,
            "supplier": 4
        }
    ]
}
```

{% endtab %}

{% tab title="200: OK No inventory found for the search criteria" %}

```javascript
{
    "count": 0,
    "previous": null,
    "next": 0,
    "result": []
}
```

{% endtab %}
{% endtabs %}

## Create Inventory

<mark style="color:green;">`POST`</mark> `/wms/inventory`

This api used to create an inventory entry. All below mentioned important informations regarding inventory the sku number, location quantity, allocated quantity, the client and other details needs to be passed as per the contract as documented below.&#x20;

#### Headers

| Name                                       | Type   | Description                       |
| ------------------------------------------ | ------ | --------------------------------- |
| API\_KEY<mark style="color:red;">\*</mark> | String | Contact Blowhorn team for API Key |

#### Request Body

| Name                                             | Type           | Description                                                                                                                                                                                                                                                                                                                                          |
| ------------------------------------------------ | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| tag<mark style="color:red;">\*</mark>            | String         | Client tag to be associated with this inventory. Ex: 'TAG-1Y28W7L'                                                                                                                                                                                                                                                                                   |
| sku                                              | Integer        | <p>Unique identifier of the SKU. </p><p><strong>Note</strong>: This is conditionally optional. Either <strong>sku</strong> or <strong>sku\_name</strong> should be provided for identifying the SKU for adding the inventory.</p>                                                                                                                    |
| sku\_name                                        | String         | <p>Unique name of the SKU. </p><p><strong>Note</strong>: This is conditionally optional. Either <strong>sku</strong> or <strong>sku\_name</strong> should be provided for identifying the SKU for adding the inventory.</p>                                                                                                                          |
| pack\_config                                     | Integer        | <p>Unique identifier of the pack config of the associated SKU of this inventory. </p><p><strong>Note</strong>: This is conditionally optional. Either <strong>pack\_config</strong> or <strong>pack\_config\_name</strong> should be provided for identifying the pack config of the SKU.</p>                                                        |
| pack\_config\_name                               | String         | <p>Unique name of the pack config of the associated SKU of this inventory. </p><p><strong>Note</strong>: This is conditionally optional. Either <strong>pack\_config</strong> or <strong>pack\_config\_name</strong> should be provided for identifying the pack config of the SKU.</p>                                                              |
| tracking\_level                                  | Integer        | <p>Unique identifier of the tracking level of the associated SKU of this inventory. </p><p><strong>Note</strong>: This is conditionally optional. Either <strong>tracking\_level</strong> or <strong>tracking\_level\_name</strong> should be provided for identifying the tracking level of the SKU.</p>                                            |
| tracking\_level\_name                            | String         | <p>Unique name of the tracking level of the associated SKU of this inventory. </p><p><strong>Note</strong>: This is conditionally optional. Either <strong>tracking\_level</strong> or <strong>tracking\_level\_name</strong> should be provided for identifying the tracking level of the SKU.</p>                                                  |
| supplier                                         | Integer        | <p>Unique identifier of the SKU supplier for this inventory.</p><p><strong>Note</strong>: This is conditionally optional. Either <strong>supplier</strong> or <strong>supplier\_name</strong> should be provided for identifying the supplier.</p>                                                                                                   |
| supplier\_name                                   | String         | <p>Unique name of the SKU supplier for this inventory.</p><p><strong>Note</strong>: This is conditionally optional. Either <strong>tracking\_level</strong> or <strong>tracking\_level\_name</strong> should be provided for identifying the tracking level of the SKU for adding the inventory.</p>                                                 |
| client                                           | Integer        | <p>Warehouse Client id to which the item belongs.</p><p><strong>Note</strong>: This is conditionally optional. Either <strong>client</strong> or <strong>client\_name</strong> or both can be provided for identifying a <strong>client</strong> to associate this inventory or else both can be left empty if need not to associate with any.</p>   |
| client\_name                                     | String         | <p>Warehouse Client name to which the item belongs.</p><p><strong>Note</strong>: This is conditionally optional. Either <strong>client</strong> or <strong>client\_name</strong> or both can be provided for identifying a <strong>client</strong> to associate this inventory or else both can be left empty if need not to associate with any.</p> |
| location                                         | Integer        | <p>Warehouse location identifier.</p><p><strong>Note</strong>: This is conditionally optional. Either <strong>location</strong> or <strong>location\_name</strong> or both can be provided for identifying a <strong>location</strong> to associate this inventory or else both can be left empty if need not to associate with any.</p>             |
| location\_name                                   | String         | <p>Warehouse location name.</p><p><strong>Note</strong>: This is conditionally optional. Either <strong>location</strong> or <strong>location\_name</strong> or both can be provided for identifying a <strong>location</strong> to associate this inventory or else both can be left empty if need not to associate with any.</p>                   |
| site                                             | Integer        | <p>Warehouse site identifier.</p><p><strong>Note</strong>: This is conditionally optional. Either <strong>site</strong> or site<strong>\_name</strong> or both can be provided for identifying a <strong>site</strong> to associate this inventory.</p>                                                                                              |
| site\_name                                       | String         | <p>Warehouse site name.</p><p><strong>Note</strong>: This is conditionally optional. Either <strong>site</strong> or site<strong>\_name</strong> or both can be provided for identifying a <strong>site</strong> to associate this inventory.</p>                                                                                                    |
| qty<mark style="color:red;">\*</mark>            | Integer        | Total available quantity for the inventory                                                                                                                                                                                                                                                                                                           |
| allocated\_qty<mark style="color:red;">\*</mark> | Integer        | allotted quantity out of existing available for the inventory for any order.                                                                                                                                                                                                                                                                         |
| status<mark style="color:red;">\*</mark>         | String         | Status of the inventory which can be either '**Locked**' or '**Unlocked**'                                                                                                                                                                                                                                                                           |
| weight                                           | Decimal        | Total weight of the inventory.                                                                                                                                                                                                                                                                                                                       |
| mfg\_date                                        | DateTime       | Manufactured date of the inventory SKU items.                                                                                                                                                                                                                                                                                                        |
| expiry\_date                                     | DateTime       | Expiry date of the inventory SKU items.                                                                                                                                                                                                                                                                                                              |
| dimension                                        | Integer/String | <p>Dimension of the inventory. </p><p><strong>Ex</strong>: '10x10x10 cc'</p>                                                                                                                                                                                                                                                                         |
| remarks                                          | String         | Any additional comments or remarks to be added to the inventory.                                                                                                                                                                                                                                                                                     |
| container                                        | String         | Container name used for this inventory.                                                                                                                                                                                                                                                                                                              |

{% tabs %}
{% tab title="200: OK Successful creation of Inventory entry" %}

```json
{
    "status": "PASS",
    "message": {
        "id": 72180,
        "sku": 89,
        "tag": "TAG-007M008",
        "qty": 15,
        "allocated_qty": 0
    }
}
```

{% endtab %}

{% tab title="400: Bad Request Error When mandatory fields missing" %}

```javascript
{
    "status": "FAIL",
    "message": "Missing either tag, site, qty or allocated qty"
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid SKU" %}

```javascript
{
    "status": "FAIL",
    "message": "Invalid sku or sku_name."
}
```

{% endtab %}

{% tab title="401: Unauthorized Unauthorized/Wrong API Key" %}

```javascript
{
  "status": "FAIL",
  "message": "Unauthorized"
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid Site ID / Name" %}

```javascript
{
    "status": "FAIL",
    "message": "Invalid site or site_name."
}
```

{% endtab %}
{% endtabs %}

Below schema examples shows various combination of payload can be used for creating the inventory. 'id' for any field takes priority and if not passed then internally name field is used for lookup.

{% tabs %}
{% tab title="Sample Create Inventory | Schema(both id & name) " %}

```json
{
    "tag": "TAG-007M001",
    "sku": 89,
    "sku_name": "Cannon Digital Camera",
    "pack_config": 6,
    "pack_config_name": "Box of 1",
    "tracking_level": 4,
    "tracking_level_name": "Each",
    "location": 6,
    "location_name": "Default Client-7",
    "client": 4,
    "client_name": "Default Client",
    "site":7,
    "site_name": "Banashankari WH",
    "supplier": 4,
    "supplier_name": "Client ABC Corp",
    "qty": 15,
    "allocated_qty": 0,
    "status": "UnLocked",
    "weight": "2700.00",
    "expiry_date": "2023-01-22T05:30:00+05:30",
    "mfg_date": "2022-04-17T05:30:00+05:30",
    "remarks": "Sample remark which is optional",
    "dimensions": "10x10x10 cc",
    "container": null
}    
```

{% endtab %}

{% tab title="Sample Create Inventory | Schema 2(with only id)" %}

```json
{
    "tag": "TAG-007M001",
    "sku": 89,
    "pack_config": 6,
    "tracking_level": 4,
    "location": 6,
    "client": 4,
    "site":7,
    "supplier": 4,
    "uom": "g",
    "qty": 15,
    "allocated_qty": 0,
    "status": "UnLocked",
    "weight": "2700.00",
    "expiry_date": "2023-01-22T05:30:00+05:30",
    "mfg_date": "2022-04-17T05:30:00+05:30",
    "remarks": "Sample remark which is optional",
    "dimensions": 12345,
    "container": null
}
```

{% endtab %}

{% tab title="Sample Create Inventory | Schema 3(with only name)" %}

```json
{
    "tag": "TAG-007M001",
    "sku_name": "Cannon Digital Camera",
    "pack_config_name": "Box of 1",
    "tracking_level_name": "Each",
    "location_name": "Default Client-7",
    "client_name": "Default Client",
    "site_name": "Banashankari WH",
    "supplier_name": "Client ABC Corp",
    "uom": "g",
    "qty": 15,
    "allocated_qty": 0,
    "status": "UnLocked",
    "weight": "2700.00",
    "expiry_date": "2023-01-22T05:30:00+05:30",
    "mfg_date": "2022-04-17T05:30:00+05:30",
    "remarks": "Sample remark which is optional",
    "dimensions": "10x10x10 cc",
    "container": null
}
```

{% endtab %}
{% endtabs %}
