Webhook inventory.count.updated quantity before change

Hello, is there a way for me to know the quantity of a catalog item variation before the update? The documentation states:

State adjustments

The inventory.count.updated webhook event also sends notifications when a quantity of item variations changes state. For state adjustments, inventory.count.updated sends a single notification containing two inventory counts: one count that describes the quantity and state before the state change and one that describes the quantity and state after the state change.

Here is the sample data that Square provides:

{
   "type": "inventory.count.updated",
   "event_id": "123456",
   "created_at": "2019-05-14T17:51:44Z",
   "merchant_id": "MERCHANT123",
   "data": {
      "inventory_counts": [
         {
           "location_id": "locationToken",
           "catalog_object_id": "XYZ456",
           "catalog_object_type": "ITEM_VARIATION",
           "state": "IN_STOCK",
           "quantity": "12.375",
           "calculated_at": "2019-05-14T17:51:27Z"
         }
      ]
   }
}

Where would I be able to find the quantity of the item before the state change?
I need to know whether or not the updated quantity was an addition or subtraction to the current inventory. Thank you.

Hi @roberto welcome to the forums!

You can find a history of changes using the Inventory API. For example, you can call RetrieveInventoryChanges to see a history of the changes. You can base the addition/subtraction on whatever the state is (ie IN_STOCK is adding inventory to your stock, so this is an addition). Please let me know if you have any additional questions or concerns, I’m happy to help!

Hello sjosey, thank you for your reply!

I was wondering, is there a way I can look up the specific event that triggered the adjustment and filter out the rest of the history? Thank you.

Once you find it in the above endpoint, it will have either an ADJUSTMENT or PHYSICAL_COUNT as the type. You can retrieve the id and pass it to either RetrieveInventoryPhysicalCount or RetrieveInventoryAdjustment which takes an id as a parameter. Please let me know if I misunderstood, or if you have additional questions.