Get available stock for list of skus

I want to be able to get the available inventory for a list of SKUs and return the quantity but I don’t know what query I could use to get this data

Hi @Chris !
This query might help:

query{
  products{
    request_id
    complexity
    data( first: 33){
      edges{
        node{
          id
          sku
          warehouse_products{
            on_hand
            backorder
            allocated
            available
          }
        }
      }
    }
  }
} 

Available might add some complexity/cost to this query, so unless really necessary, the best way is to avoid using it so you can get first:100 instead of first:33

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

Would there be a way to grab a specific list of skus because there is lots of products i just want to grab 20 with a specific sku

Hey @Chris !
Would an Inventory Snapshot work for you?
Ref.: https://developer.shiphero.com/inventory-snapshot
That one should give you all of them at once

How would i go about figuring out the cost of a query would this be the complexity ?

That is correct
If you would like to know the compexity before actually making the request you can include Analyze:true
Something like this:

query {
  account(analyze:true) {
    request_id
    complexity
    data {
      id
      legacy_id
    }
  }
}

This should return you the "complexity": 1, Which is the cost of the Query

Is it possible to raise the credit allowance ?

Hi @Chris we are not raising credits right now, but if you want I could try and help you find a workaround for the query that is making you run out of credits
Thanks again!

i have to check stock for 120 different skus and get the availability of each sku because im affecting a json file that is reloaded every 2 minutes

Yes, in that case, I would suggest the inventory snapshot to avoid running out of credits.
Or another would be to use the Query above but without including Available and making a pause between requests until the credits are restored:

query{
  products{
    request_id
    complexity
    data( first: 33){
      edges{
        node{
          id
          sku
          warehouse_products{
            on_hand
            backorder
            allocated
          }
        }
      }
    }
  }
}