Dr. McKay Posted May 20, 2016 Report Posted May 20, 2016 Sometimes it can be a little confusing to identify a specific item in the Steam economy. There are several different types of IDs present in one particular item, and a lot of vague terminology. This guide aims to clear all that up for you. For starters, the "official" term for a Steam item is an asset. When I say a "Steam item", I mean a particular copy of an item. I'm not referring to the item's definition, name, image, or anything. I'm referring to a specific, unique copy of the item. In a general sense, every item on Steam must be owned by an app. An "app" is a game, software, or whatever on Steam. Every app has its own unique AppID. You can find a particular game's AppID by going to its store page or community hub and looking at the URL. For example, TF2's AppID is 440 so TF2's store page can be found at http://store.steampowered.com/app/440. CS:GO's is 730, Dota 2's is 570, and so on. Note that Steam Community items, Steam gifts, and other "Steam" items are owned by the "Steam" app, which has AppID 753. To identify an item, you'll need the AppID of the game which owns it. Of course, the AppID alone isn't enough. You also need two other IDs. Have you ever noticed how some games have multiple inventories, which appear in a drop-down list? An example is the Steam inventory, which has sub-inventories for "Community", "Gifts", "Coupons", etc. These "sub-inventories" are called contexts, and each context has its own context ID. If a game doesn't have a drop-down menu to select a context, that doesn't mean that it's without contexts. That only means that it has one single visible context. That single context still has an ID. For all current Valve games, the context ID for the publicly-visible context is 2. Context IDs can be a bit tricky. It's entirely up to the game's developer to determine how they work. For example, Valve games take the "single shared inventory" model in which there's one context ID which is shared by everyone. Under this model, an item belongs to one particular context and never leaves that context. Consequently, the item's context ID never changes. It is, however, possible for game developers to create contexts in any way they choose. For example, Spiral Knights uses the "per-character inventory" model in which everyone who plays the game has their own context IDs for their characters. Creating a new character creates a new context ID. This means that when an item is traded between users, its context ID will change as it moved out of a particular character's inventory. Those are the two different types of "containers" in the Steam economy. Apps own contexts, and contexts own assets. Every asset on Steam has, in addition to its AppID and context ID, an asset ID which is guaranteed to be unique inside of a given AppID+ContextID combination. Notice that this means that asset IDs are not unique across all of Steam. They aren't even unique across a particular app. They are only unique inside of a given context. For example, there could be two items with asset ID 1 in the same game, as long as they have different context IDs. An item's asset ID may be referred to as "assetid" or just plain "id". Context IDs and asset IDs are assigned by the game developer and can follow any pattern. They can change when traded or not. They may both be up to 64 bits in size. Consequently, Steam returns them (like all other 64-bit values) in JSON as strings. Still following? All of what we've learned so far leads us to this conclusion: in order to uniquely identify an item, you need its AppID, its context ID, and its asset ID. Once you have these three things, only then can you uniquely identify it. In fact, this is how you link to a particular item in a user's inventory: steamcommunity.com/profiles/steamid/inventory#appid_contextid_assetid. Here's an example: https://steamcommunity.com/id/DoctorMcKay/inventory#440_2_134161610What are these "classid" and "instanceid" values though? The observant reader may have noticed that there are two more IDs attached to a particular item which I haven't mentioned. These are the "classid" and "instanceid". These IDs are used to map an asset to its description. What's a description? A description is what you need in order to actually display an item. An item's description contains its name, image, color, market_name, whether it's tradable or not, whether it's marketable or not, and more. There are many endpoints on Steam which return JSON objects representing assets that only contain the asset's AppID, context ID, asset ID, classid, instanceid, and amount. An item's amount is how big of a stack it is. Unstackable items always have an amount of 1. Stackable items (such as Steam gems) may have a larger amount. Stacked items always have the same asset ID. What's the difference between a classid and an instanceid? In a nutshell, a classid "owns" an instanceid. The classid is all you need to get a general overview of an item. For example, items with the same classid will pretty much always have the same name and image. The instanceid allows you to get finer details such as how many kills are on a strange/StatTrak weapon, or custom names/descriptions. You can turn a classid/instanceid pair into a description using the GetAssetClassInfo WebAPI method. Notice that the instanceid is actually optional: if you only have a classid that's fine, you just won't get finer details for the item.Name? Market Name? Market Hash Name? Every asset on Steam has a name. Without a name, there's nothing to show in your inventory. The item's name is the name property of its description. The item's name may be localized if the game's developer has set it up to be. Every marketable item also has a "market name". This name may be the same as—or different from—the item's regular name. The item's market name is the market_name property of its description. This is the name that's displayed in the Steam Community Market when the item is up for sale. Why the distinction? There are some items which have value-affecting data that isn't in their name; for example, CS:GO skins have 5 different tiers of "wear", which isn't in their names. The wear tier is appended to each skin's market name however, so that the different tiers of wear are separated in the market. The market name may be localized or not, and may not exist at all if the item isn't marketable. It's up to the game's developer. Finally, every marketable item also has a "market hash name", available under the market_hash_name property. This name is supposed to be the English version of the item's market name, but in practice it may vary. For example, Steam Community items prepend the AppID of the originating app to each item's market hash name, but not to the market name. The market hash name is never localized, and may not exist if the item isn't marketable. Again, it's up to the game's developer. You can view the Community Market listings for any marketable item using this URL formula: steamcommunity.com/market/listings/appid/market_hash_name. Here's an example: https://steamcommunity.com/market/listings/440/Mann%20Co.%20Supply%20Crate%20Key Note that the Community Market has no concept of contexts. Consequently, market [hash] names are unique for a particular "class" of items per-app (and by extension per-context). This means that for marketable items, two items with identical market hash names will be worth roughly the same (with some exceptions, like unusual TF2 items).Questions? Ask below. I'm happy to help! Mole, EthanBOT, Andrew and 7 others 10
bigode71 Posted May 29, 2016 Report Posted May 29, 2016 So there isn't any easy way to link an item the bot received to the original owner? In my project we may need to give items back to the user. If the items can change their names and their 5 IDs after a trade or something, we'll have to figure out a guaranteed way to make sure that we will always know who were the owners of the items, and this sounds too much difficult... Can anyone here help me with this?
Dr. McKay Posted May 29, 2016 Author Report Posted May 29, 2016 So there isn't any easy way to link an item the bot received to the original owner? In my project we may need to give items back to the user. If the items can change their names and their 5 IDs after a trade or something, we'll have to figure out a guaranteed way to make sure that we will always know who were the owners of the items, and this sounds too much difficult... Can anyone here help me with this? The trade receipt page contains the new item data. If you're using node-steam-tradeoffer-manager, you only need to use offer.getReceivedItems.
bigode71 Posted May 30, 2016 Report Posted May 30, 2016 I'm using the c# SteamBot actually, and I didn't find nothing like that getReceivedItems in the trades classes :/ If you know if there is such function in the c# project, it would be a great help But I'll keep looking. If i don't find anything I guess I can make it on my own if i take a look to the node project,and even later make a PR to the Github project, so it will help more users. Thanks anyway!
vshezhuoji Posted May 31, 2016 Report Posted May 31, 2016 Hello Dr.McKay!I think currently I am using the same way to get all items in app or display users' inventory on the website.However I find that some other way to identify steam items. 1.using http://api.steampowered.com/IEconItems_<appid>/GetPlayerItems/v1?key=<apikey>&language=&SteamID= to get one user's items . 2.defindex combine with quality can identify a item as market_hash_name do.(same defindex items have same image // e.g. http://cdn.dota2lounge.com/img/items/6627.jpg and this 6627 is a defindex. As I notice this result is much more light than inventory url call.And seemed it can get csgo items float rate thing.But still ,I don't know much details about the result.Can you tell me some information? { "id": 235841514, "original_id": 230806844, //some are same as "id" "defindex": 36,//same image "level": 1, "quality": 4,//as tier of wear or something "inventory": 12, "quantity": 1, "rarity": 5, "attributes": [ { "defindex": 6, "value": 1132527616, "float_value": 258 }, { "defindex": 7, "value": 1144904910, "float_value": 759.4500732421875 }, { "defindex": 8, "value": 1045680265, "float_value": 0.20685018599033356 }, { "defindex": 147, "value": "models/weapons/stattrack.mdl" }, { "defindex": 39, "value": 0, "float_value": 0.56000000238418579 }, { "defindex": 40, "value": 0, "float_value": 0.05000000074505806 }, { "defindex": 145, "value": "models/weapons/w_pist_p250_mag.mdl" }, { "defindex": 199, "value": 26, "float_value": 3.6433760072445244e-044 } ] },
Dr. McKay Posted May 31, 2016 Author Report Posted May 31, 2016 On 5/31/2016 at 12:58 AM, vshezhuoji said: -snip- I purposefully didn't mention the WebAPIs because they aren't really "Steam items". They're "Valve items", and third-party games don't need to follow any of the same standards. However, for Valve games, the "id" in the WebAPI is the item's asset ID, and "original_id" is the item's asset ID when it was originally created. If it's identical to the item's "id", that means that the item was never traded or modified. Quality (generally) determines the color of the item's name, and (sometimes) a prefix to the item's name (for example, StatTrak, ★, etc). Quality has nothing to do with wear. For CS:GO, you can't really get much useful information out of the WebAPI except an item's raw wear value (frequently, incorrectly, and ignorantly referred to as its "float value") and perhaps original ID. Mole and Robert Lutece 2
vshezhuoji Posted May 31, 2016 Report Posted May 31, 2016 I purposefully didn't mention the WebAPIs because they aren't really "Steam items". They're "Valve items", and third-party games don't need to follow any of the same standards. However, for Valve games, the "id" in the WebAPI is the item's asset ID, and "original_id" is the item's asset ID when it was originally created. If it's identical to the item's "id", that means that the item was never traded or modified. Quality (generally) determines the color of the item's name, and (sometimes) a prefix to the item's name (for example, StatTrak, ★, etc). Quality has nothing to do with wear. For CS:GO, you can't really get much useful information out of the WebAPI except an item's raw wear value (frequently, incorrectly, and ignorantly referred to as its "float value") and perhaps original ID.Thanks for your help.I never consider about the issue of steam items or valve items .At first I dealing with dota2 items.By getting many inventory json results and get items information by GetAssetClassInfo (eventually I made my website identifying items by market_hash_names).After that I find that if I use WebAPIs to make clear defindex+quality=market_hash_name.The volume of data can be lower as there are less description .But as you say those apps' items are complex.Using WebAPI to get items only limited in several apps(dota2 csgo tf2 steam?).The problem is if I want to trade .I need ids and identifing every items.Both inventory json and this IEconItems(limited apps) can provide.The question is I don't know how to get description only by IEconItems. like what are"attributes" means .And there are no classids,does it means IEconItems can't describe items as inventory json do?. Also ,if I want float value, IEconItems is necessary ,is there any official or unofficial documents about the result?
Dr. McKay Posted May 31, 2016 Author Report Posted May 31, 2016 Thanks for your help.I never consider about the issue of steam items or valve items .At first I dealing with dota2 items.By getting many inventory json results and get items information by GetAssetClassInfo (eventually I made my website identifying items by market_hash_names).After that I find that if I use WebAPIs to make clear defindex+quality=market_hash_name.The volume of data can be lower as there are less description .But as you say those apps' items are complex.Using WebAPI to get items only limited in several apps(dota2 csgo tf2 steam?).The problem is if I want to trade .I need ids and identifing every items.Both inventory json and this IEconItems(limited apps) can provide.The question is I don't know how to get description only by IEconItems. like what are"attributes" means .And there are no classids,does it means IEconItems can't describe items as inventory json do?. Also ,if I want float value, IEconItems is necessary ,is there any official or unofficial documents about the result? I'm not very familiar with Dota, but as far as I know TF2 and possibly Dota are the only Valve games where IEconService gives enough useful information to build an item's display information. For everything else, you need to use inventory JSON. Attributes are only a concept in Valve-land; the Steam econ server has no concept of "attributes". Consequently, attribute data doesn't translate to the inventory JSON. Attributes are just that: attributes attached to an item. For example in TF2 an attribute might change how much damage the weapon does. In CS:GO, wear is an attribute. IEconService has no classids because again, it has no concept of classids. They're entirely assigned by and used by the Steam econ server, and consequently they're only available in the econ endpoints (like inventory JSON and GetAssetClassInfo).
Watwat Posted June 13, 2016 Report Posted June 13, 2016 as far as I know TF2 and possibly Dota are the only Valve games where IEconService gives enough useful information to build an item's display information. For everything else, you need to use inventory JSON. How would one go about that? Neither GetPlayerItems nor the schema say anything about an items classID. I'd rather not fetch the inventory JSON, unless I absolutely have to, for fear of getting banned.
Dr. McKay Posted June 13, 2016 Author Report Posted June 13, 2016 As I said previously, GetPlayerItems comes directly from the item server and bypasses the econ server, so it has no concept of classids. You need to use the appropriate GetSchema call to get display information.
Watwat Posted June 16, 2016 Report Posted June 16, 2016 I forgot to mention that I'm mainly interested in the market_hash_name of the items. The backpack.tf API doesn't feature all items (weapon skins and a bunch of outliers) Outside of "building" it on my own using the quality and name attributes, one does have to use the inventory JSON, which makes sense, because as you put it, neither GetSchema nor GetPlayerItems has no concept of something like the Steam market. Any tips on how to not get on Valve's bad side when scraping inventory JSON besides using a VPN?
Dr. McKay Posted June 17, 2016 Author Report Posted June 17, 2016 There isn't any way besides just using a bunch of IP addresses.
stackola Posted June 22, 2016 Report Posted June 22, 2016 I know this is thread is more about steam in general and does not apply much to specific games I still thought this would be the best place to ask. Do you happen to know how the CS:GO id system works? Most of the time, the classId uniquely identifies a type of weapon, so all USP-S Blue Spruce (Field Tested) (without stickers or stattrak) will have the same classId but a different instanceId, but sometimes there's 2 identical weapons with the same description tags but different classIds. Instead the InstanceId of these items is the same. How would one go about building a table to look up descriptions without the classId matching consistently. http://i.imgur.com/0Zeqsmd
Dr. McKay Posted June 22, 2016 Author Report Posted June 22, 2016 That's just how Valve does it. The classid/instanceid can also include some hidden data that isn't displayed in the actual item data, so you'll just have to live with whatever duplicates you get.
stackola Posted June 22, 2016 Report Posted June 22, 2016 So the most reasonable thing might be to use the market hash name as the unique field and just ignore any extra attributes. Not sure how well this works for other games like Dota though, I heard they have a lot of item customization.
Dr. McKay Posted June 22, 2016 Author Report Posted June 22, 2016 You'll miss out on things like stickers and custom names if you use market_hash_name as your unique field.
Japolk Posted July 1, 2016 Report Posted July 1, 2016 Thank u very much. Exact information what i was looking for
Watwat Posted July 8, 2016 Report Posted July 8, 2016 How come that sometimes, when polling the TF2 inventory JSON, the keys in rgInventory (the IDs of items) do not match up with the IDs provided by the GetPlayerItems call? Sometimes they do, sometimes they don't. steamcommunity.com/id/XXXXXXX/inventory/json/440/2The appID as well as the contextID are the correct ones in this URL.
yellowish Posted August 11, 2016 Report Posted August 11, 2016 Dear Dr. McKay, as this is my first post in here, I'd like to thank you for your work. It saves us all a lot of time. However Im consused on checkin the stickers wear's value. Stickers on a weapon. How do I know which defindex is which?
Dr. McKay Posted August 11, 2016 Author Report Posted August 11, 2016 You have to check the item schema for that.
yellowish Posted August 11, 2016 Report Posted August 11, 2016 (edited) Yes, I'm on that part. But what's the proper way to identify that exact sticker on GetSchema API? Names definitely aren't exact, it seems like nothing matches together #edit:forgive me my ignorance. I just released the structure is completely different to what I thought it is. Edited August 11, 2016 by yellowish
yellowish Posted August 12, 2016 Report Posted August 12, 2016 (edited) Excuse me please, for posting post under another, but I'd like thread to be bumped. What does it mean when sticker is not listed on any of the sticker slots on IEconItems, but is placed as HTML tag in item's descriptions on user's inventory? Like here: "367883549_480087296":{ "appid":"730", "classid":"367883549", "instanceid":"480087296", "icon_url":"-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpopbmkOVUw7PvRTipH7s-JkIGZnPLmDLfYkWNFpp102r_ErdutiwbmqUtuMG-hdoeVdgNoY16F-wPsku_mh5Dq7cian3B9-n51JZMMtxo", "icon_url_large":"-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpopbmkOVUw7PvRTipH7s-JkIGZnPLmDLfYkWNF18lwmO7Eu9Tw2AKx80RkMGvxdo6XIQBsM1nQ_lTow-i6hMTu75zAy3Q163Vxs33D30vgugbUquA", "icon_drag_url":"", "name":"StatTrakâ„¢ SCAR-20 | Crimson Web", "market_hash_name":"StatTrakâ„¢ SCAR-20 | Crimson Web (Minimal Wear)", "market_name":"StatTrakâ„¢ SCAR-20 | Crimson Web (Minimal Wear)", "name_color":"CF6A32", "background_color":"", "type":"StatTrakâ„¢ Mil-Spec Grade Sniper Rifle", "tradable":1, "marketable":1, "commodity":0, "market_tradable_restriction":"7", "descriptions":[ { "type":"html", "value":"Exterior: Minimal Wear" }, { "type":"html", "value":" " }, { "type":"html", "value":"This item features StatTrakâ„¢ technology, which tracks certain statistics when equipped by its owner.", "color":"99ccff" }, { "type":"html", "value":" " }, { "type":"html", "value":"StatTrakâ„¢ Confirmed Kills: 715", "color":"CF6A32" }, { "type":"html", "value":"*Stats for this item will reset when used in Steam Trading or Community Market", "color":"ff4040" }, { "type":"html", "value":" " }, { "type":"html", "value":"The SCAR-20 is a semi-automatic sniper rifle that trades a high rate of fire and powerful long-distance damage for sluggish movement speed and big price tag. It has been painted using a spider web-patterned hydrographic over a red base coat and finished with a semi-gloss topcoat.\n\n<i>Be careful where you walk, you never know where the web is spread</i>" }, { "type":"html", "value":" " }, { "type":"html", "value":"The Arms Deal 2 Collection", "color":"9da1a9", "app_data":{ "def_index":"65535", "is_itemset_name":1 } }, { "type":"html", "value":" " }, { "type":"html", "value":"<br><div id=\"sticker_info\" name=\"sticker_info\" title=\"Sticker Details\" style=\"border: 2px solid rgb(102, 102, 102); border-radius: 6px; width=100; margin:4px; padding:8px;\"><center><img width=64 height=48 src=\"https://steamcdn-a.akamaihd.net/apps/730/icons/econ/stickers/standard/thirteen.bcec4689b3d28dd0c9fd5d3f119842639d286dc5.png\"><br>Sticker: Lucky 13</center></div>", "app_data":{ "def_index":"65535" } } ], { "id":561293657, "original_id":265616091, "defindex":38, "level":1, "quality":9, "inventory":23, "quantity":1, "rarity":3, "attributes":[ { "defindex":6, "value":1130889216, "float_value":232 }, { "defindex":7, "value":1144062999, "float_value":708.0639038085938 }, { "defindex":8, "value":1040999533, "float_value":0.13710184395313263 }, { "defindex":80, "value":715, "float_value":1.0019284019922442e-42 }, { "defindex":81, "value":0, "float_value":0 }, { "defindex":113, "value":13, "float_value":1.8216880036222622e-44 }, { "defindex":228, "value":4294967295, "float_value":-1 }, { "defindex":229, "value":4294967295, "float_value":-1 }, { "defindex":147, "value":"models/weapons/stattrack.mdl" }, { "defindex":230, "value":2, "float_value":2.802596928649634e-45 }, { "defindex":231, "value":5, "float_value":7.006492321624085e-45 }, { "defindex":39, "value":0, "float_value":0.38999998569488525 }, { "defindex":40, "value":0, "float_value":0.5 }, { "defindex":145, "value":"models/weapons/w_snip_scar20_mag.mdl" }, { "defindex":199, "value":90, "float_value":1.2611686178923354e-43 } ] }, I, personally can think of one reason why it might be showing like that, but that's jus suspicion; the sticker might be completely scratched. But does it make any sense? Edited August 12, 2016 by yellowish
tchosniper Posted December 6, 2016 Report Posted December 6, 2016 So can I use offer.addMyItem({"appid": 730, "contextid": 2, "classid": "xxxx"}); or offer.addMyItem({"appid": 730, "contextid": 2, "instanceid": "xxxx"}); or I need use only with assetid?
Recommended Posts