Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

steamapi

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

steamapi

A nice Steam API wrapper.

  • 2.5.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

SteamAPI

NPM Discord

Setup

Installation

npm i steamapi

Getting an API Key

Once signed into Steam, head over to http://steamcommunity.com/dev/apikey to generate an API key.

Usage

First, we start by making a SteamAPI "user".

const SteamAPI = require('steamapi');
const steam = new SteamAPI('steam token');

Now, we can call methods on the steam object.

For example, let's retrieve the SteamID64 of a user. SteamAPI provides a resolve method, which accepts URLs and IDs.

steam.resolve('https://steamcommunity.com/id/DimGG').then(id => {
	console.log(id); // 76561198146931523
});

Now let's take that ID, and fetch the user's profile.

steam.getUserSummary('76561198146931523').then(summary => {
	console.log(summary);
	/**
	PlayerSummary {
		avatar: {
			small: 'https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/7f/7fdf55394eb5765ef6f7be3b1d9f834fa9c824e8.jpg',
			medium: 'https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/7f/7fdf55394eb5765ef6f7be3b1d9f834fa9c824e8_medium.jpg',
			large: 'https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/7f/7fdf55394eb5765ef6f7be3b1d9f834fa9c824e8_full.jpg'
		},
		steamID: '76561198146931523',
		url: 'http://steamcommunity.com/id/DimGG/',
		created: 1406393110,
		lastLogOff: 1517725233,
		nickname: 'Dim',
		primaryGroupID: '103582791457347196',
		personaState: 1,
		personaStateFlags: 0,
		commentPermission: 1,
		visibilityState: 3
	}
	*/
});

Documentation

SteamAPI

Kind: global class

new SteamAPI(key, [options])

Sets Steam key for future use.

ParamTypeDefaultDescription
keystringSteam key
[options]Object{}Optional options for caching and warnings getGameDetails()
[options.enabled]booleantrueWhether caching is enabled
[options.expires]number86400000How long cache should last for in ms (1 day by default)
[options.disableWarnings]booleanfalseWhether to suppress warnings

steamAPI.get(path, [base], [key]) ⇒ Promise.<Object>

Get custom path that isn't in SteamAPI.

Kind: instance method of SteamAPI
Returns: Promise.<Object> - JSON Response

ParamTypeDefaultDescription
pathstringPath to request e.g '/IPlayerService/GetOwnedGames/v1?steamid=76561198378422474'
[base]string"this.baseAPI"Base URL
[key]string"this.key"The key to use

steamAPI.resolve(info) ⇒ Promise.<string>

Resolve info based on id, profile, or url. Rejects promise if a profile couldn't be resolved.

Kind: instance method of SteamAPI
Returns: Promise.<string> - Profile ID

ParamTypeDescription
infostringSomething to resolve e.g 'https://steamcommunity.com/id/xDim'

steamAPI.getAppList() ⇒ Promise.<Array.<App>>

Get every single app on steam.

Kind: instance method of SteamAPI
Returns: Promise.<Array.<App>> - Array of apps

steamAPI.getFeaturedCategories() ⇒ Promise.<Array.<Object>>

Get featured categories on the steam store.

Kind: instance method of SteamAPI
Returns: Promise.<Array.<Object>> - Featured categories

steamAPI.getFeaturedGames() ⇒ Promise.<Object>

Get featured games on the steam store

Kind: instance method of SteamAPI
Returns: Promise.<Object> - Featured games

steamAPI.getGameAchievements(app) ⇒ Promise.<Object>

Get achievements for app id.

Kind: instance method of SteamAPI
Returns: Promise.<Object> - App achievements for ID

ParamTypeDescription
appstringApp ID

steamAPI.getGameDetails(app, [force], [region], [language]) ⇒ Promise.<Object>

Get details for app id. Requests for this endpoint are limited to 200 every 5 minutes Not every region is supported. Only the following are valid: us, ca, cc, es, de, fr, ru, nz, au, uk. Not every language is supported. A list of available languages can be found here.

Kind: instance method of SteamAPI
Returns: Promise.<Object> - App details for ID

ParamTypeDefaultDescription
appstringApp ID
[force]booleanfalseOverwrite cache
[region]string"us"Currency region
[language]string"english"Description language

steamAPI.getGameNews(app) ⇒ Promise.<Array.<Object>>

Get news for app id.

Kind: instance method of SteamAPI
Returns: Promise.<Array.<Object>> - App news for ID

ParamTypeDescription
appstringApp ID

steamAPI.getGamePlayers(app) ⇒ Promise.<number>

Get number of current players for app id.

Kind: instance method of SteamAPI
Returns: Promise.<number> - Number of players

ParamTypeDescription
appstringApp ID

steamAPI.getGameSchema(app) ⇒ Promise.<Object>

Get schema for app id.

Kind: instance method of SteamAPI
Returns: Promise.<Object> - Schema

ParamTypeDescription
appstringApp ID

steamAPI.getServers(host) ⇒ Promise.<Array.<Server>>

Get every server associated with host.

Kind: instance method of SteamAPI
Returns: Promise.<Array.<Server>> - Server info

ParamTypeDescription
hoststringHost to request

steamAPI.getUserAchievements(id, app) ⇒ Promise.<PlayerAchievements>

Get users achievements for app id.

Kind: instance method of SteamAPI
Returns: Promise.<PlayerAchievements> - Achievements

ParamTypeDescription
idstringUser ID
appstringApp ID

steamAPI.getUserBadges(id) ⇒ Promise.<PlayerBadges>

Get users badges.

Kind: instance method of SteamAPI
Returns: Promise.<PlayerBadges> - Badges

ParamTypeDescription
idstringUser ID

steamAPI.getUserBans(id) ⇒ Promise.<(PlayerBans|Array.<PlayerBans>)>

Get users bans. If an array of IDs is passed in, this returns an array of PlayerBans

Kind: instance method of SteamAPI
Returns: Promise.<(PlayerBans|Array.<PlayerBans>)> - Ban info

ParamTypeDescription
idstring | Array.<string>User ID(s)

steamAPI.getUserFriends(id) ⇒ Promise.<Array.<Friend>>

Get users friends.

Kind: instance method of SteamAPI
Returns: Promise.<Array.<Friend>> - Friends

ParamTypeDescription
idstringUser ID

steamAPI.getUserGroups(id) ⇒ Promise.<Array.<string>>

Get users groups.

Kind: instance method of SteamAPI
Returns: Promise.<Array.<string>> - Groups

ParamTypeDescription
idstringUser ID

steamAPI.getUserLevel(id) ⇒ Promise.<number>

Get users level.

Kind: instance method of SteamAPI
Returns: Promise.<number> - Level

ParamTypeDescription
idstringUser ID

steamAPI.getUserOwnedGames(id, [includeF2P]) ⇒ Promise.<Array.<OwnedGame>>

Get users owned games.

Kind: instance method of SteamAPI
Returns: Promise.<Array.<OwnedGame>> - Owned games

ParamTypeDefaultDescription
idstringUser ID
[includeF2P]booleantrueWhether to include user's free-to-play games or not

steamAPI.getUserRecentGames(id, [count]) ⇒ Promise.<Array.<Game>>

Get users recent games.

Kind: instance method of SteamAPI
Returns: Promise.<Array.<Game>> - Recent games

ParamTypeDescription
idstringUser ID
[count]numberOptionally limit the number of games to fetch to some number

steamAPI.getUserServers([hide], [key]) ⇒ Promise.<PlayerServers>

Gets servers on steamcommunity.com/dev/managegameservers using your key or provided key.

Kind: instance method of SteamAPI
Returns: Promise.<PlayerServers> - Servers

ParamTypeDefaultDescription
[hide]booleanfalseHide deleted/expired servers
[key]string"this.key"Key

steamAPI.getUserStats(id, app) ⇒ Promise.<PlayerStats>

Get users stats for app id.

Kind: instance method of SteamAPI
Returns: Promise.<PlayerStats> - Stats for app id

ParamTypeDescription
idstringUser ID
appstringApp ID

steamAPI.getUserSummary(id) ⇒ Promise.<(PlayerSummary|Array.<PlayerSummary>)>

Get users summary. If an array of IDs is passed in, this returns an array of PlayerSummary

Kind: instance method of SteamAPI
Returns: Promise.<(PlayerSummary|Array.<PlayerSummary>)> - Summary

ParamTypeDescription
idstring | Array.<string>User ID(s)

Keywords

FAQs

Package last updated on 14 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc