API for inventory changes

Hey guys,

We’re looking to fetch inventory changes / stock adjustments made in ShipHero and push them into Cin7.

We are looking to fetch these changes two ways possibly, maybe using a Webhook or the GraphSQL API to access the Inventory Change schema if there was a way to tell if this change was due to a stock adjustment rather than a bin transfer or move. Can you confirm if the Schema which I think we think we would use? See screenshot below:

Thanks for the help!

Hey @teamzorali,

Thanks for reaching out!

Yes, if you wanted to query for inventory changes that query would be the one to use. An example query could look something like this:

{
  inventory_changes(date_from: "_____", date_to: "_____") {
    request_id
    complexity
    data(first: 20) {
      edges {
        node {
          id
          legacy_id
          account_id
          sku
          previous_on_hand
          change_in_on_hand
          reason
        }
      }
    }
  }
}

If you want us to push updates to an endpoint, I recommend looking at our Inventory Update Webhook. The Inventory Update Webhook will fire anytime a products on hand quantity changes.

Please let me know if you have any questions or concerns.

Best,
RayanP

When looking at webhook Inventory Update, or via the query function above, what is the best way to tell if this is a item adjustment rather than shipping a good, transferring between bins, or other movement which is not a write on or write off?

Regards,
Lloyd

Hey @lloyd,

Thanks for reaching out!

The webhook body doesn’t include the reason for the webhook fire. However, with the above query, the reason field will return the cause of the change.

Please let me know if you have any questions or concerns.

Best,
RayanP

Can you point me to the documentation about the different reason codes I can expect to find? I need to figure out how to filter for actual inventory write off/on changes (for example nil pick adjustments, stock damage, found stock) to pass these through to an ERP/Inventory system.

Regards,
Lloyd

Hey again @lloyd,

Thanks for the quick replies!

There is no documentation about the different reason values. The value is specific in how it will return which PO was received or which Order Number was shipped etc.

For example, I ran the query in my test account, and this was my response:

{
  "data": {
    "inventory_changes": {
      "request_id": "6579b9b3d614f729658031f9",
      "complexity": 21,
      "data": {
        "edges": [
          {
            "node": {
              "id": "TG9jYXRpb25DaGFuZ2VMb2c6NDk1MjIwNjA5",
              "legacy_id": 495220609,
              "account_id": "QWNjb3VudDo2MDUzNA==",
              "sku": "testsku0305",
              "previous_on_hand": 1,
              "change_in_on_hand": -1,
              "reason": "Change from the product page via the ShipHero Web Dashboard."
            }
          },
          {
            "node": {
              "id": "TG9jYXRpb25DaGFuZ2VMb2c6NTAyMjU5NTkw",
              "legacy_id": 502259590,
              "account_id": "QWNjb3VudDo2MDUzNA==",
              "sku": "CHALLENGER",
              "previous_on_hand": 3,
              "change_in_on_hand": -1,
              "reason": "Order <a href=\"/dashboard/orders/details/420737789\">#M79</a> shipped"
            }
          },
          {
            "node": {
              "id": "TG9jYXRpb25DaGFuZ2VMb2c6NTAyODcyNzA2",
              "legacy_id": 502872706,
              "account_id": "QWNjb3VudDo2MDUzNA==",
              "sku": "CHARGER",
              "previous_on_hand": 50,
              "change_in_on_hand": -1,
              "reason": "Order <a href=\"/dashboard/orders/details/419660330\">#M78</a> shipped"
            }
          },
          {
            "node": {
              "id": "TG9jYXRpb25DaGFuZ2VMb2c6NTAyOTMwNDU2",
              "legacy_id": 502930456,
              "account_id": "QWNjb3VudDo2MDUzNA==",
              "sku": "CHALLENGER",
              "previous_on_hand": 51,
              "change_in_on_hand": 9,
              "reason": "Received from Purchase Order <a href=\"/dashboard/purchase-orders/details/1844626\">PO 27</a>"
            }
          },
          {
            "node": {
              "id": "TG9jYXRpb25DaGFuZ2VMb2c6NTAyOTMwNDY4",
              "legacy_id": 502930468,
              "account_id": "QWNjb3VudDo2MDUzNA==",
              "sku": "CHARGER",
              "previous_on_hand": 0,
              "change_in_on_hand": 9,
              "reason": "Received from Purchase Order <a href=\"/dashboard/purchase-orders/details/1844626\">PO 27</a>"
            }
          },
          {
            "node": {
              "id": "TG9jYXRpb25DaGFuZ2VMb2c6NTAyOTMxMTM4",
              "legacy_id": 502931138,
              "account_id": "QWNjb3VudDo2MDUzNA==",
              "sku": "5278-43976#14",
              "previous_on_hand": 3299,
              "change_in_on_hand": -1,
              "reason": "Change from the product page via the ShipHero Web Dashboard."
            }
          }
        ]
      }
    }
  }

Please let me know if you have any questions or concerns.

Best,
RayanP