# Inventory

**URL:** https://heroiclabs.com/docs/hiro/typescript/inventory/
**Keywords:** inventory, hiro
**Categories:** hiro, typescript, inventory

---


# Inventory

Read more about the Inventory system in Hiro [here](../../concepts/inventory/).

## List items

List all inventory items defined in the codex, optionally filtered by category.

```typescript
const request = new InventoryListRequest();
request.item_category = "weapons";

const inventoryList = await hiroClient.inventoryList(session, request);
console.log(inventoryList);
```

## List user inventory items

List all inventory items owned by the player, optionally filtered by category.

```typescript
const request = new InventoryListRequest();
request.item_category = "weapons";

const inventoryList = await hiroClient.inventoryListInventory(session, request);
console.log(inventoryList);
```

## Consume inventory items

Consume one or more inventory items owned by the player.

```typescript
const request = new InventoryConsumeRequest();
request.items = {
    "health_potion": "1"
};

const consumeRewards = hiroClient.inventoryConsume(session, request);
console.log(consumeRewards);
```

## Grant inventory items

Grant one or more inventory items to the player.

```typescript
const request = new InventoryGrantRequest();
request.items = {
    "bronze_sword": "1"
};

const grantRewards = await hiroClient.inventoryGrant(session, request);
console.log(grantRewards);
```

### Remove inventory items

To remove items from a user's inventory, without consuming them, use a negative grant value.

```typescript
const request = new InventoryGrantRequest();
request.items = {
    "bronze_sword": "-1"
};

const grantRewards = await hiroClient.inventoryGrant(session, request);
console.log(grantRewards);
```

## Update inventory items

Update the properties on one or more inventory items owned by the player.

```typescript
const request = new InventoryUpdateItemsRequest();
request.item_updates = {
    "bronze_sword": {
        string_properties: {
            "example_property": "example_value"
        },
        numeric_properties: {
            "numeric_properties": 10
        }
    }
};

const updateAck = await hiroClient.inventoryUpdate(session, request);
console.log(updateAck);
```