This topic has been locked
Hrcak Nov 1, 2018 @ 7:07am
Grabbing json data of inventory, what's the limit / best practice?
Hey,

I'm writing an app that reads inventory by parsing data from /inventory/json/753/6 on a given public profile.
I've run into extreme limitations regarding the calls, which affect IP in general.
I think it's less than 5 per minute?

What would be the best way to do this in terms of having a bit more requests per minute?
< >
Showing 1-4 of 4 comments
MalikQayum Nov 1, 2018 @ 9:08am 
the inventory endpoint is RESTful and not a REST, so the api 100.000k requests a day does not apply here. basically what you are doing is crawling this RESTful.
The rate limits are unknown, i doubt anyone would be able to give you a clear cut answer in regards to this, so my suggestion is to actually make a check when you recieve your error and then set a delay to check when your ip ban&cooldown is gone.

additionally i can see you are targeting the community items and using the old endpoint as you do would probably not be advised as it essentially means more requests to that endpoint when a new endpoint gives you the ability to do it less on really large inventories (2k+ items ).
old endpoint : /inventory/json/753/6
new endpoint: /inventory/<steamid>/753/6

https://steamcommunity.com/inventory/76561198049216736/753/6?l=english&count=5000

"total_inventory_count":400,
"success":1,
"rwgrsn":-2}

so this works well on small inventories and the old endpoint would certainly also do its job however on mine you can tell the difference:

https://steamcommunity.com/inventory/76561198034957967/753/6?l=english&count=5000

"more_items":1,
"last_assetid":"5285663602",
"total_inventory_count":10230,
"success":1,"rwgrsn":-2}

so where you would have to make, i believe, 6 requests with the old endpoint you could be making 3 with the new.

and to make sure there is no more "pages"/"items", you can either check the total inventory count and see if it is between a range and set a number for it, such as in this case 3 and have the script loop this 3 times.

or the simpel way and check if the json has either the property "more_items" or "last_assetid" as it is being removed from the json if there are less than 5000 items in the json.

https://steamcommunity.com/inventory/76561198034957967/753/6?l=english&count=5000&start_assetid=5285663602

"more_items":1,
"last_assetid":"8159788449",
"total_inventory_count":10230,
"success":1,"rwgrsn":-2}

https://steamcommunity.com/inventory/76561198034957967/753/6?l=english&count=5000&start_assetid=8159788449

,"total_inventory_count":10230,
"success":1,"rwgrsn":-2}

anyways, just a way for you to optimize your script to make it do fewer requests to larger inventories and perhaps avoid hitting a rate limit.
Last edited by MalikQayum; Nov 1, 2018 @ 9:22am
Wok Nov 2, 2019 @ 1:20pm 
Thanks a lot. I did not realize there was a new endpoint with better rate limits.
War Pig Sep 4, 2023 @ 11:41am 
Resurrecting this as I've been playing around with retrieving inventory using this endpoint *after* the further inventory restrictions Valve imposed at the end of 2022. I have a rather large inventory and have been trying to chug through it by requesting 5000 items at a time, but I always encounter the "429 Client Error: Too many requests" problem on the 3rd request. There doesn't seem to be a "Retry-After" suggestion in the returned header, so I've been flying blind with trying to figure out a reasonable pause value before trying again to continue retrieving the rest. Experimenting with different values has been slow to say the least as I'm usually locked out for a while after making a few attempts.

Does anyone have any updates to add here from recent experience?
Rosa Sep 4, 2023 @ 12:50pm 
This thread was quite old before the recent post, so we're locking it to prevent confusion.
< >
Showing 1-4 of 4 comments
Per page: 1530 50

Date Posted: Nov 1, 2018 @ 7:07am
Posts: 4