I want to get products inventory old record, can you please confirm it's possible via API or not

Hi @Tom,
I have a few questions for you, please let me know it’s possible via API or not.
1) I want to get products old inventory details.
Ex. let suppose I want to know the quantity of SKU (sku123) at 14 AUG 2020?
2) if yes we can retrieve those details, So how older data we can get?

Hi @madhupatel!
You could use the inventory_changes query and set a specific SKU + Date Range, something like this:

query {
  inventory_changes(
    sku: "sku123"
    date_from: "2020-08-14"
    date_to: "2020-08-15"
  ) {
    request_id
    complexity
    data {
      edges {
        node {
          user_id
          account_id
          warehouse_id
          sku
          previous_on_hand
          change_in_on_hand
          reason
          cycle_counted
          location_id
          created_at
        }
      }
    }
  }
} 

Let me know if that doesn’t work for you.
Thanks in advance!
Tom

1 Like

Hi @tomasw
Thank you for your reply.
please also confirm
1). how older data we can get(EX: 2 year ,3 year or any date range)?

2). can we check in bulk (multiple sku at a time)?

Hi @madhupatel!

It should allow you to see the exact same information that you see on the Product Detail page (under the Inventory section)

Unfortunately no. However, you can instead just use date ranges, and it will return you all the inventory changes for that date range (if that helps as a workaround)
Thanks again!
Tom

Hi @tomasw
Thank you for your clarification, it’s working fine for me.
in the above query, any field is available for the updated_at date?
or any proper documentation for inventory_changes query so I can check more available fields?

Sure @madhupatel!
Are you on a Dynamic Slotting account?

We don’t have a document itself with the fields, because they are available while checking the Schema and Docs that allows you to see all the fields available for every query. But if you want, I could create an example at our developer site.

And as for the updated_at, it should be the same as created_at, because in that case created_at refers to the time the record was created (the change was made).

Thanks again!
Tom

Got your point.
Are you on a [Dynamic Slotting account? >> No

Perfect @madhupatel!
In that case the query is something like this:

query {
  inventory_changes(
    sku: "sku123"
    date_from: "2020-08-14"
    date_to: "2020-08-15"
  ) {
    request_id
    complexity
    data(first: 100) {
      pageInfo {
        hasNextPage
        endCursor
      }
      edges {
        node {
          user_id
          account_id
          warehouse_id
          sku
          previous_on_hand
          change_in_on_hand
          reason
          cycle_counted
          created_at
        }
      }
    }
  }
} 

And those are all the fields available.
I asked about the slotting type because with Dynamic Slotting you can also see the location, but that is not the case for Static Slotting that only has one location.

Let me know if there is anything else I could help with.
Thanks again!
Tom