# Best Way to automate updating large amount of Skus

**URL:** <https://community.shiphero.com/t/best-way-to-automate-updating-large-amount-of-skus/85>\
**Category:** GraphQL API\
**Created:** [August 20, 2019, 5:09pm UTC](https://community.shiphero.com/t/best-way-to-automate-updating-large-amount-of-skus/85 "2019-08-20T17:09:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisshoes](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chrisshoes](https://community.shiphero.com/u/chrisshoes)\
**Post date:** [August 20, 2019, 5:09pm UTC](https://community.shiphero.com/t/best-way-to-automate-updating-large-amount-of-skus/85/1 "2019-08-20T17:09:26Z")

</div>

Hi,  
What is the best practice for updating the onhand of a lot of SKUs at once?

I noticed the graphql api as inventory\_add and inventory\_remove. Is there an inventory\_set? (To set at a specific amount?)

Basically, our ERP dumps out a file of about 50k skus (out of 500k) every night with their onhands. I want to automate updating the skus in shiphero from this file.

My thought process is: pull down all the skus from shiphero (500k!!!) find the delta (ones that have changed onhand levels between what the ERP file and the shiphero results, then use a mutation to set the ones that have changed.

It seems like there might be a better way to do this. Any ideas?

Thanks,

---

<div class="post-metadata">

**Author:** ![jeremyw](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jeremyw](https://community.shiphero.com/u/jeremyw)\
**Post date:** [August 21, 2019, 12:28pm UTC](https://community.shiphero.com/t/best-way-to-automate-updating-large-amount-of-skus/85/2 "2019-08-21T12:28:17Z")

</div>

I don’t have a suggestion of a better way, but something that you’ll quickly run into is the credit limit on API usage. It’s currently set at 5000 per hour. I haven’t tried mutations (updates) myself yet, so I’m not sure if the credit cost is different, but in general for simpler queries (requests) I find that requesting 100 records uses 101 credits . If the same holds true for mutations, it would take you 11 hours to update 50,000 skus. Updating 500,000 skus would take daaaaays.

---

<div class="post-metadata">

**Author:** ![tomasw](https://sea2.discourse-cdn.com/flex020/user_avatar/community.shiphero.com/tomasw/32/248_2.png) [@tomasw](https://community.shiphero.com/u/tomasw)\
**Post date:** [August 21, 2019, 1:50pm UTC](https://community.shiphero.com/t/best-way-to-automate-updating-large-amount-of-skus/85/3 "2019-08-21T13:50:18Z")

</div>

Hi Chris!  
For updating On Hand inventory you could use the warehouse\_product\_update mutation, using the **sku, warehouse\_id** and **on\_hand.**  
On the other hand, I agree with Jeremy on the credit part.  
Will you be updating the 500k at once, constantly? or just the ones with actual inventory change?

---

<div class="post-metadata">

**Author:** ![seba](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@seba](https://community.shiphero.com/u/seba)\
**Post date:** [August 21, 2019, 2:02pm UTC](https://community.shiphero.com/t/best-way-to-automate-updating-large-amount-of-skus/85/4 "2019-08-21T14:02:39Z")

</div>

@chrisshoes This can be done in different ways. Let me explain a bit.  
First, you can also use `warehouse_product_update` to set the on\_hand directly.

Now talking about syncing your data with shiphero, we have ways of getting changes that occurred on our side, you have the webhooks and there’s also the query `inventory_changes` that can be filtered by sku, warehouse, location and data ranges.

In your case, looks like you are trying to sync with us the changes detected on your side, and that might be a bit more trickier. At first I would say, just for that is probably not necessary to download the entire inventory. You could just have a mechanism for detecting those that changed on your side, and then check those products in our API. This way you would be only hitting our api for those products that had changed on your side, reducing the amount of unnecessary requests. The flow would be:

- detect changes per sku on your side
- check each sku querying `products` or `warehouse_products` by sku
- if outdated on our side, use the `warehouse_product_update` mutation to set the `on_hand`

Does that make sense?

---

<div class="post-metadata">

**Author:** ![chrisshoes](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chrisshoes](https://community.shiphero.com/u/chrisshoes)\
**Post date:** [August 21, 2019, 2:14pm UTC](https://community.shiphero.com/t/best-way-to-automate-updating-large-amount-of-skus/85/5 "2019-08-21T14:14:05Z")

</div>

Yes this makes sense.

Is there a way to update multiple SKU onhand at once using the warehouse\_product\_update mutation? or do they need to be one request at a time?

Thanks,

---

<div class="post-metadata">

**Author:** ![seba](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@seba](https://community.shiphero.com/u/seba)\
**Post date:** [August 21, 2019, 2:20pm UTC](https://community.shiphero.com/t/best-way-to-automate-updating-large-amount-of-skus/85/6 "2019-08-21T14:20:08Z")

</div>

@chrisshoes I’m afraid there’s no bulk operation for updating sku’s on\_hand for now, so it has to be made one by one.

---

<div class="post-metadata">

**Author:** ![chrisshoes](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@chrisshoes](https://community.shiphero.com/u/chrisshoes)\
**Post date:** [August 21, 2019, 2:48pm UTC](https://community.shiphero.com/t/best-way-to-automate-updating-large-amount-of-skus/85/7 "2019-08-21T14:48:35Z")

</div>

Hmmm I’m still thinking about if there is another way to do this.

Are there other options outside of the API to do this? (and outside of a manual CSV upload)

For example, with Shopify we provide a URL that is simply a list of SKUs and their OnHands. Shopify pulls this every couple hours and updates the changes automatically.

Do you have anything similar?

Or is there a way to automate CSV inventory change upload? (Rather than having someone do it manually)

---

<div class="post-metadata">

**Author:** ![seba](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@seba](https://community.shiphero.com/u/seba)\
**Post date:** [August 22, 2019, 1:20pm UTC](https://community.shiphero.com/t/best-way-to-automate-updating-large-amount-of-skus/85/8 "2019-08-22T13:20:06Z")

</div>

There’s no such functionality in our app yet, we are thinking about such feature but don’t have an ETA.  
Out of curiosity, the url you provide to shopify points to a csv file with just skus and on\_hand values?
