Help Needed with inventory_add Mutation

Hello Community,

I’m facing an issue with the inventory_add mutation using the ShipHero API. I’m attempting to add inventory to a warehouse, but I’m encountering an error related to a bin location.

mutation Inventory_add {
    inventory_add(
        data: {
            sku: "test2"
            warehouse_id: "14805"
            quantity: 30
        }
    ) {
        warehouse_product {
            id
            legacy_id
            account_id
            sku
            warehouse_id
            warehouse_identifier
            price
            value
            value_currency
            on_hand
            inventory_bin
            inventory_overstock_bin
            reserve_inventory
            replenishment_level
            reorder_amount
            reorder_level
            backorder
            allocated
            available
            non_sellable_quantity
            in_tote
            custom
            customs_value
            created_at
            updated_at
            sell_ahead
            active
        }
    }
}

Error Response

{
    "errors": [
        {
            "message": "Location (Bin) 2029945 not found",
            "operation": "inventory_add",
            "field": "inventory_add",
            "request_id": "66d70697f1ef252e33c56599",
            "code": 5
        }
    ],
    "data": {
        "inventory_add": null
    },
    "extensions": {
        "throttling": {
            "estimated_complexity": 10,
            "cost": 10,
            "cost_detail": {
                "inventory_add": {
                    "items_count": 0,
                    "cost": 10,
                    "total_cost": 10,
                    "fields": {}
                }
            },
            "user_quota": {
                "credits_remaining": 1992,
                "max_available": 2002,
                "increment_rate": 30
            }
        }
    }
}

Hi @NaserKH

Welcome to the ShipHero community!

Looking at the request, I see you are impersonated in the child account. Since this is a “3PL client-only” type of account, adding inventory will not work because the 3PL manages locations (Bins).

To make the mutation, you need to stand from the 3PL account and add the customer_account_id field to add the inventory to the right child account.

Note that if you don’t specify the location_id field in the mutation, it will locate the inventory in the “unassigned” bin.

Try this:

mutation Inventory_add {
  inventory_add(data: { customer_account_id: "xxxxx" sku: "test2", warehouse_id: "14805", quantity: 30 }) {
    warehouse_product {
      id
      legacy_id
      account_id
      sku
      warehouse_id
      warehouse_identifier
      price
      value
      value_currency
      on_hand
      inventory_bin
      inventory_overstock_bin
      reserve_inventory
      replenishment_level
      reorder_amount
      reorder_level
      backorder
      allocated
      available
      non_sellable_quantity
      in_tote
      custom
      customs_value
      created_at
      updated_at
      sell_ahead
      active
    }
  }
}

Have a nice day!