steamstash
v2.0.0
Published
steamstash
Readme
SteamStash
A powerful, lightweight library for interacting with Steam Community and Store data.
Features
- Fetch user profiles, mini profiles, and friends lists
- Get Steam group information and members
- Check app details from the Steam store
- Proxy support for all requests
- Configurable timeout handling
Installation
bun add steamstashOr using npm:
npm install steamstashBasic Usage
import steamAPI from "steamstash";
// Get a user's profile data
const profile = await steamAPI.getProfileData("76561198028121353");
console.log(`User name: ${profile.name}, Level: ${profile.level}`);
// Get a user's friends list
const friends = await steamAPI.getFriendsList("76561198028121353");
console.log(`User has ${friends.length} friends`);Advanced Configuration
import { SteamAPI } from "steamstash";
// Create a custom instance with advanced options
const customAPI = new SteamAPI({
timeout: 5000, // 5 second timeout
httpProxy: "1.2.3.4:8080", // Use proxy for requests
});
// Use the custom instance
const profile = await customAPI.getProfileData("76561198028121353");API Reference
User Data
getMiniProfileData(steamid64: string): Promise<SteamMiniProfile>
Fetches mini profile data for a Steam user.
const miniProfile = await steamAPI.getMiniProfileData("76561198028121353");
console.log(miniProfile.persona_name);getFriendsList(steamid64: string): Promise<SteamFriend[]>
Fetches friend list data for a Steam user.
const friends = await steamAPI.getFriendsList("76561198028121353");
friends.forEach((friend) => {
console.log(`${friend.name} - ${friend.status}`);
});getProfileData(steamid64: string): Promise<SteamProfileData>
Fetches profile data for a Steam user.
const profile = await steamAPI.getProfileData("76561198028121353");
console.log(`Name: ${profile.name}`);
console.log(`Level: ${profile.level}`);
console.log(`Game count: ${profile.gameCount}`);Group Data
getGroupDataById(groupId: string): Promise<SteamGroupData>
Fetches data for a Steam group by numeric ID.
const group = await steamAPI.getGroupDataById("45887305");
console.log(`Group name: ${group.name}`);
console.log(`Members: ${group.memberCount}`);
console.log(`Founded: ${group.founded}`);
if (group.founded_date) {
console.log(`Founded date: ${group.founded_date}`);
}getGroupDataByUrl(groupUrl: string): Promise<SteamGroupData>
Fetches data for a Steam group by URL identifier.
const group = await steamAPI.getGroupDataByUrl("valve");
console.log(`Group name: ${group.name}`);
console.log(`Members: ${group.memberCount}`);
console.log(`Founded: ${group.founded}`);
if (group.founded_date) {
console.log(`Founded date: ${group.founded_date}`);
}The SteamGroupData object includes:
name: The name of the grouptag: The group tag/abbreviationurl: The group URL identifierimageHash: The group image hashmemberCount: Number of members in the groupfounded: When the group was founded (as a string, e.g., "24 April, 2024" or "7 December")founded_date: ISO timestamp of when the group was founded, ending in00:00:00.000Z(optional, only present if the date can be parsed)state: Group access state ("public", "private", or "inviteOnly")
getGroupMembers(groupId: string, page?: number): Promise<SteamGroupMembersPage>
Fetches members for a Steam group. Supports pagination.
// Get first page of group members
const membersPage = await steamAPI.getGroupMembers("valve");
console.log(`Total members: ${membersPage.totalMembers}`);
console.log(
`Current page: ${membersPage.currentPage} of ${membersPage.totalPages}`
);
// Members on the current page
membersPage.members.forEach((member) => {
console.log(`${member.name} - ${member.status}`);
});
// Get the second page
const secondPage = await steamAPI.getGroupMembers("valve", 2);App Data
getAppDetails(appId: string): Promise<AppDetails>
Fetches app details for a Steam app.
const app = await steamAPI.getAppDetails("220"); // Half-Life 2
console.log(`App name: ${app.name}`);
console.log(`Counts as game: ${app.countsAsGame}`);
console.log(`Region restricted: ${app.regionRestricted}`);The AppDetails object includes:
name: The name of the appcountsAsGame: Whether the item counts as a game in Steam profilesregionRestricted: Whether the app is unavailable in your current region (if true,countsAsGamewill be false)
Market Listings
getMarketListingsByName(marketHashName: string, start?: number, count?: number, country?: string, language?: string, currency?: number): Promise<MarketListingResult>
Fetches market listings for a specific item name (marketHashName) in CS:GO (appId 730).
const listings = await steamAPI.getMarketListingsByName(
"Glock-18 | High Beam (Factory New)"
);
console.log(listings.length); // Number of listings found
console.log(listings[0].price); // Price of the first listing
console.log(listings[0].inspect); // Inspect link for the first listingEach listing is a MarketListing object:
id: Listing IDprice: Price in the selected currencyinspect: Inspect link for the itemfee: Fee amountsteam_fee: Steam's feeconverted_price: Price in the selected currencyconverted_fee: Fee in the selected currencyconverted_price_with_fee: Total price (converted_price + converted_fee)
The return type is MarketListingResult, which is an array of MarketListing objects.
Market Data
getPriceOverview(appid: number, marketHashName: string, country?: string, currency?: number): Promise<PriceOverview>
Fetches an overview of the price of an item on the Steam Community Market.
const priceOverview = await steamAPI.getPriceOverview(
730, // App ID (e.g., 730 for CS:GO)
"AK-47 | Redline (Field-Tested)",
"US", // Country code
1 // Currency ID (1 for USD)
);
console.log(`Lowest Price: ${priceOverview.lowest_price}`);
if (priceOverview.volume) {
console.log(`Volume: ${priceOverview.volume}`);
}
if (priceOverview.median_price) {
console.log(`Median Price: ${priceOverview.median_price}`);
}The PriceOverview object includes:
success: Boolean indicating if the request was successful.lowest_price(optional): The lowest price of the item.volume(optional): The number of items sold in the last 24 hours.median_price(optional): The median sale price of the item.
queryMarket(appid: number, query?: string, start?: number, count?: number, searchDescriptions?: boolean, sortColumn?: string, sortDir?: string, noRender?: number): Promise<MarketQueryResult>
Queries the Steam Community Market for items.
Parameters:
appid(number): The application ID for the game to query items from.query(string, optional): The search query string. Defaults to "".start(number, optional): The starting offset for results. Defaults to 0.count(number, optional): The number of results to return. Defaults to 10.searchDescriptions(boolean, optional): Whether to search in descriptions as well (0 or 1). Defaults tofalse.sortColumn(string, optional): Column to sort by (e.g., 'popular', 'price').sortDir(string, optional): Sort direction ('asc' or 'desc').noRender(number, optional): Set to 1 for JSON response. Defaults to 1.
Returns: Promise<MarketQueryResult>
getGemValue(appid, itemType, borderColor)
Fetches the "goo value" (gem value) for a specific item type from the Steam Community Auction.
Parameters:
appid(number): The application ID of the game the item belongs to (e.g.,2400for some auction-related items).itemType(number): The specific type of the item.borderColor(number): The border color identifier for the item.
Returns: Promise<GemValueResponse> - An object containing:
_ success (number): 1 if successful.
_ goo_value (string): The gem value as a string (e.g., "60").
Example Usage:
const steamAPI = new SteamAPI();
async function fetchGemValue() {
try {
const gemData = await steamAPI.getGemValue(2400, 4, 1);
console.log("Gem Value:", gemData.goo_value); // Output: Gem Value: 60 (or other value)
} catch (error) {
console.error("Failed to fetch gem value:", error);
}
}
fetchGemValue();Utility Functions
convertSteamID64ToSteamID32(steamid64: string): number
Converts a 64-bit Steam ID to its 32-bit representation.
import { convertSteamID64ToSteamID32 } from "steamstash";
const steamid32 = convertSteamID64ToSteamID32("76561198028121353");
console.log(steamid32); // Outputs the 32-bit Steam IDLicense
MIT
