-
Notifications
You must be signed in to change notification settings - Fork 7
ISteamUserStats
Game statistics related APIs; achievements, scores, stats, etc.
Method | Description |
---|---|
GetGlobalAchievementPercentagesForApp | The percentage of app owners with the specific achievements. |
GetNumberOfCurrentPlayers | The current number of online players for a specific game. |
GetPlayerAchievements | Get game achievement completion stats for a player. |
GetSchemaForGame | Retrieve detailed information about the stats and achievements for a game. |
GetUserStatsForGame | Get game stats for a user. |
Does NOT require an API Key! Yay!
The percentage of app owners with the specific achievements. Not a substitute for actual achievements in the game, as some games have "ghost" achievements that can appear in this API, but are not visible in the real achievement list, no longer attainable, or even deleted after initial creation. You can safely assume that any achievements with a 0% unlock rate are "ghost" achievements, and should not use them for statistics.
getGlobalAchievements(appID)
appID
required
Type:
Integer
Steam internal app ID, can also be a string
Object
achievements
Achievement percentages listed by API name. You should ignore any achievements with a 0% unlock rate, read above about "ghost" achievements.
const api = require('steam-js-api')
api.getGlobalAchievements(730).then(result => {
console.log(result.data)
}).catch(console.error)
This would display an object that looks like this one:
{
"achievements": {
"GIVE_DAMAGE_LOW": 86.1,
"KILL_ENEMY_RELOADING": 86.1,
"UNSTOPPABLE_FORCE": 85.3,
"KILL_ENEMY_LOW": 84.4,
"WIN_ROUNDS_LOW": 83,
"KILL_LOW_DAMAGE": 81.4,
"EARN_MONEY_LOW": 80.3,
"IMMOVABLE_OBJECT": 80.3,
"": 0
}
}
Does NOT require an API Key! Yay!
The current number of online players for a specific game.
getCurrentPlayers(appID)
appID
required
Type:
Integer
Steam internal app ID, can also be a string
Integer
players
Total online players
const api = require('steam-js-api')
api.getCurrentPlayers(730).then(result => {
console.log(result.data)
}).catch(console.error)
This would display an object that looks like this one:
{
"players": 569199
}
Get game achievement completion stats for a player.
getAchievements(steamID, appID)
steamID
required
Type:
String
Steam ID of the user, as a string
appID
required
Type:
Integer
Steam internal app ID, can also be a string
String
name
Full name of the gameInteger
count
Total number of achievements in the gameObject
achievements
Achievement objects listed by internal achievement nameBoolean
unlocked
Whether or not the achievement has been unlockedInteger
time
Time the achievement was unlocked, in seconds since the epoch.
const api = require('steam-js-api')
api.setKey('{{YOUR KEY}}')
api.getAchievements('76561198099490962', 264710).then(result => {
console.log(result.data)
}).catch(console.error)
This would display an object that looks like this one:
{
"name": "Subnautica",
"count": 4,
"achievements": {
"DiveForTheVeryFirstTime": {
"unlocked": true,
"time": 1516378680
},
"RepairAuroraReactor": {
"unlocked": false,
"time": 0
},
"BuildSeamoth": {
"unlocked": true,
"time": 1516777135
},
"HatchCutefish": {
"unlocked": false,
"time": 0
}
}
}
Retrieve detailed information about the stats and achievements for a game. Keep in mind that Steam doesn't seem to publicly display any stats other than achievements, despite it being tracked. Thanks Volvo.
getGameSchema(appID)
appID
required
Type:
Integer
Steam internal app ID, can also be a string
String
name
Full name of the gameInteger
statCount
Total number of tracked stats in the gameInteger
achievementCount
Total number of achievements in the gameObject
stats
Stat objects listed by internal stat nameString
displayName
String representation of the stat, is NOT guaranteed to be different from the internal api nameInteger
default
The default value of the statObject
achievements
Achievement objects listed by internal achievement nameString
displayName
String representation of the achievement, same as the name shown on individual achievement pagesString
description
String description of the achievement, will be empty if the achievement is hidden. This often describes exactly how to get the achievement, which is why hidden achievements do not return this in the api.Boolean
hidden
Whether or not the achievement is a secret (hidden) achievementString
icon
The full url to the unlocked icon imageString
iconLocked
The full url to the locked icon image, seems to be standard that this is just the unlocked version in gray-scale color
const api = require('steam-js-api')
api.setKey('{{YOUR KEY}}')
api.getGameSchema(264710).then(result => {
console.log(result.data)
}).catch(console.error)
This would display an object that looks like this one:
{
"name": "Subnautica",
"statCount": 3,
"achievementCount": 3,
"stats": {
"s1_AllTimeDepth": {
"displayName": "Max all time depth",
"default": 0
},
"s2_HasTank": {
"displayName": "Player has crafted tank",
"default": 0
},
"s3_FeedbackSubmit": {
"displayName": "Player has submitted feedback",
"default": 0
}
},
"achievements": {
"DiveForTheVeryFirstTime": {
"displayName": "Getting Your Feet Wet",
"description": "",
"hidden": true,
"icon": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/apps/264710/89b61cdeb0e1b6d22532245ce394f00d0a4277e1.jpg",
"iconLocked": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/apps/264710/680214ffd7727865ea404b897aecbc0f667a9377.jpg"
},
"RepairAuroraReactor": {
"displayName": "Extinction Event Avoided",
"description": "",
"hidden": true,
"icon": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/apps/264710/1c59192a1e1ce720cd3dc77a1ea4e663f1f5516f.jpg",
"iconLocked": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/apps/264710/680214ffd7727865ea404b897aecbc0f667a9377.jpg"
},
"HatchCutefish": {
"displayName": "\"Man's Best Friend\"",
"description": "",
"hidden": true,
"icon": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/apps/264710/7e5b3420b69b9077e7d068dc6f9c646725577599.jpg",
"iconLocked": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/apps/264710/680214ffd7727865ea404b897aecbc0f667a9377.jpg"
}
}
}
Get game stats for a user. These are internally defined by the game developer, and they are responsible for actually updating the stats. Also, Steam lags behind when stats are updated, so you simply can't rely on these stats updating in a timely manner. Trust me, I'm speaking from experience on this.
Please know that certain games have a custom object structure defined, so you need to check these pages for the data point names, rather than what the Steam API says:
getStats(steamID, appID)
steamID
required
Type:
String
Steam ID of the user, as a string
appID
required
Type:
Integer
Steam internal app ID, can also be a string
String
name
Full name of the gameInteger
count
Total number of stats returned, will likely be less than the number defined in the game schemaObject
stats
Stats listed by their original Web API name. NOTICE! Some games have custom object definitions, bulleted above.
const api = require('steam-js-api')
api.setKey('{{YOUR KEY}}')
api.getStats('76561198099490962', 264710).then(result => {
console.log(result.data)
}).catch(console.error)
This would display an object that looks like this one:
{
"name": "Subnautica",
"count": 2,
"stats": {
"s1_AllTimeDepth": 84,
"s2_HasTank": 1
}
}
> GetTradeHistory
> GetTradeStatus
> GetBadges
> GetCommunityBadgeProgress
> GetOwnedGames
> GetRecentlyPlayedGames
> GetSteamLevel
> GetAssetClassInfo
> GetAssetPrices
> GetFriendList
> GetPlayerBans
> GetPlayerSummaries
> GetUserGroupList
> ResolveVanityURL
> GetGlobalAchievement...
> GetNumberOfCurrentPlayers
> GetPlayerAchievements
> GetSchemaForGame
> GetUserStatsForGame