Steam Web API
Formats
Every method can return its results in 3 different formats: JSON, XML, and VDF. Each format represents the data described herein differently:
JSON
- The API returns an object containing the named object with the result data.
- Arrays are represented as an array with the name of the type of the objects in the array (ie. an object named "items" containing an array of objects of type "item" would be represented as an object named "items" containing an array named "item" containing several objects following the "item" structure).
- Null is represented as JSON's null.
XML
- XML Attributes are not used.
- Arrays are represented as a series of sub-elements in the containing element of the type of the array.
- Null is represented by the word "null" between the element's tags.
VDF (Valve Data Format)
- This is Valve's internal data format, as seen in uses like TF2's "scripts" folder (available in "team fortress 2 client content.gcf"). TF2's GetSchema returns data similar to "items/items_game.txt" (although qualities are not expanded into objects with a "value" field).
- Documentation of the format is in progress here.
- Arrays in the data are represented as a VDF array with the name of the type of the objects in the array, with a VDF array being an object with each item being prefixed with its numeric key as a quoted string.
- Null is represented as an empty string.
If no format is specified, the API will default to JSON.
Interfaces and method
All interfaces and method are self-documented through the ISteamWebAPIUtil/GetSupportedAPIList call. This can be found here.
When passed a key=<your API key> parameter, GetSupportedAPIList will show all APIs that your key can access. Without it (as above), it only displays APIs that do not require an API key.
Game interfaces and methods
Team Fortress 2 functions are described at http://wiki.teamfortress.com/wiki/WebAPI.
GetNewsForApp (v0002)
GetNewsForApp returns the latest of a game specified by its appID.
Example URL: http://api.steampowered.com/ISteamNews/GetNewsForApp/v0002/?appid=440&count=3&maxlength=300&format=json
Arguments
- appid
- AppID of the game you want the news of.
- count
- How many news enties you want to get returned.
- maxlength
- Maximum length of each news entry.
- format
- Output format. json (default), xml or vdf.
Result layout
An appnews object containing:
- appid, the AppID of the game you want news of
- newsitems, an array of news item information:
- An ID, title and url.
- A shortened excerpt of the contents (to maxlength characters), terminated by "..." if longer than maxlength.
- A comma-separated string of labels and UNIX timestamp.
GetGlobalAchievementPercentagesForApp (v0002)
Returns on global achievements overview of a specific game in percentages.
Arguments
- gameid
- AppID of the game you want the news of.
- format
- Output format. json (default), xml or vdf.
GetPlayerSummaries (v0002)
Example URL: http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=XXXXXXXXXXXXXXXXXXXXXXX&steamids=76561197960435530 (This will show Robin Walker's profile information.)
Returns basic profile information for a list of 64-bit Steam IDs.
Arguments
- steamids
- Comma-delimited list of 64 bit Steam IDs to return profile information for. Up to 100 Steam IDs can be requested.
- format
- Output format. json (default), xml or vdf.
Return Value
Some data associated with a Steam account may be hidden if the user has their profile visibility set to "Friends Only" or "Private". In that case, only public data will be returned.
Public Data
- steamid
- 64bit SteamID of the user
- personaname
- The player's persona name (display name)
- profileurl
- The full URL of the player's Steam Community profile.
- avatar
- The full URL of the player's 32x32px avatar. If the user hasn't configured an avatar, this will be the default ? avatar.
- avatarmedium
- The full URL of the player's 64x64px avatar. If the user hasn't configured an avatar, this will be the default ? avatar.
- avatarfull
- The full URL of the player's 184x184px avatar. If the user hasn't configured an avatar, this will be the default ? avatar.
- personastate
- The user's current status. 0 - Offline, 1 - Online, 2 - Busy, 3 - Away, 4 - Snooze. If the player's profile is private, this will always be "0".
- communityvisibilitystate
- One of three values: 1 - the profile is "Private", 2 - the profile is "Friends Only", 3 - the profile is "Public"
- profilestate
- If set, indicates the user has a community profile configured (will be set to '1')
- lastlogoff
- The last time the user was online, in unix time.
- commentpermission
- If set, indicates the profile allows public comments.
Private Data
- realname
- The player's "Real Name", if they have set it.
- primaryclanid
- The player's primary group, as configured in their Steam Community profile.
- timecreated
- The time the player's account was created.
- gameid
- If the user is currently in-game, this value will be returned and set to the gameid of that game.
- gameserverip
- The ip and port of the game server the user is currently playing on, if they are playing on-line in a game using Steam matchmaking. Otherwise will be set to "0.0.0.0:0".
- gameextrainfo
- If the user is currently in-game, this will be the name of the game they are playing. This may be the name of a non-Steam game shortcut.
- cityid
- This value will be removed in a future update (see loccityid)
- loccountrycode
- If set on the user's Steam Community profile, The user's country of residence, 2-character ISO country code
- locstatecode
- If set on the user's Steam Community profile, The user's state of residence
- loccityid
- An internal code indicating the user's city of residence. A future update will provide this data in a more useful way.
GetFriendList (v0001)
Returns the friend list of any Steam user, provided his Steam Community profile visibility is set to "Public".
Arguments
- steamid
- 64 bit Steam ID to return friend list for.
- relationship
- Relationship filter. Possibles values: all, friend.
- format
- Output format. json (default), xml or vdf.
Result data
The user's friends list, as an array of friends. Nothing will be returned if the profile is private.
- steamid
- 64 bit Steam ID of the friend.
- relationship
- Relationship qualifier
- friend_since
- Unix timestamp of the time when the relationship was created.
Community pages parameters
Most of Steam Community information can be returned in XML format by appending ?xml=1
to their URLs. This method does not require API key.
Community data
The Steam community data interface (XML only) is described here: https://partner.steamgames.com/documentation/community_data
Implementations
- [Steam Web Lua SDK] Lua 5 module which covers all new interfaces as utilized in Steam Mobile
- [Steam Web API library] C# library for Steam Friends interaction.
- Steam Condenser Ruby, PHP, and Java library.