Easy to use, fully typed wrapper for interacting with Skinport API.
- Official Skinport API documentation
- You can get your Skinport API key here
Install it from npm:
$ npm install skinport.js
If you're using ESM ("type": "module" in package.json), you can directly import Skinport using import.
import Skinport from "skinport.js";
const skinport = new Skinport('clientId', 'clientSecret');
skinport.getItems();
skinport.getTransactions();
...If you're using CommonJS (require() based system), use await import().
(async () => {
const { default: Skinport } = await import("skinport.js");
const skinport = new Skinport('clientId', 'clientSecret');
skinport.getItems();
skinport.getTransactions();
...
})();You don't need to pass clientId and clientSecret for methods which don't require authentication.
import Skinport from "skinport.js";
const skinport = new Skinport('clientId', 'clientSecret');
await skinport.initSocket();
const socket = skinport.socket;Note: Trying to access .socket property before calling initSocket() will throw an error.
const skinport = new Skinport('clientId', 'clientSecret');- clientId: string (optional) (required for secured methods)
- clientSecret: string (optional) (required for secured methods)
Extends socket.io-client's Socket class. Will throw an error if accessed before calling initSocket().
await skinport.initSocket();
const socket = skinport.socket;socket.on is io().on wrapper that includes typings support for Skinport websocket events.
socket.on(event, listener);- event: string (required)
- "saleFeed"
- listener: Function (required)
Event callback function has typings support.
socket.on("saleFeed", (data) => {
/*
* data extends SaleFeedData interface
*
* Available properties:
* {
* eventType: listed | sold,
* sales: any[],
* }
*/
const { eventType, sales } = data;
})socket.emit is io().emit wrapper that includes typings support for Skinport websocket emitters.
socket.emit(event, data);- event: string (required)
- "saleFeedJoin"
- data: object (required)
Event emitter data has typings support.
socket.emit("saleFeedJoin", data);
/*
* data extends SaleFeedJoinData interface
*
* Available properties:
* {
* appid: number,
* currency: string,
* locale: string
* }
*/Initializes the websocket
Provides a list of items available on the marketplace, along with their associated metadata.
- options: object (optional)
Authorization: Not required
| Property | Type | Required | Description |
|---|---|---|---|
| app_id | number | Optional | The app_id for the inventory's game (default 730). |
| currency | string | Optional | The currency for pricing (default EUR - Supported: AUD, BRL, CAD, CHF, CNY, CZK, DKK, EUR, GBP, HRK, NOK, PLN, RUB, SEK, TRY, USD). |
| tradable | boolean | Optional | If true, it shows only tradable items on the market (default false). |
const items = skinport.getItems({ app_id: 730, currency: "EUR", tradable: true });
console.log(items);Provides aggregated data for specific in-game items that have been sold on Skinport.
- options: object (optional)
Authorization: Not required
| Property | Type | Required | Description |
|---|---|---|---|
| market_hash_name | string | Optional | The item's names, comma-delimited. |
| app_id | number | Optional | The app_id for the inventory's game (default 730). |
| currency | string | Optional | The currency for pricing (default EUR - Supported: AUD, BRL, CAD, CHF, CNY, CZK, DKK, EUR, GBP, HRK, NOK, PLN, RUB, SEK, TRY, USD). |
const salesHistory = skinport.getSalesHistory({ market_hash_name: "Glove Case,★ Karambit | Slaughter (Minimal Wear)", app_id: 730, currency: "EUR" });
console.log(salesHistory);Provides information about in-game items that are currently out of stock on Skinport.
- options: object (optional)
Authorization: Not required
| Property | Type | Required | Description |
|---|---|---|---|
| app_id | number | Optional | The app_id for the inventory's game (default 730). |
| currency | string | Optional | The currency for pricing (default EUR - Supported: AUD, BRL, CAD, CHF, CNY, CZK, DKK, EUR, GBP, HRK, NOK, PLN, RUB, SEK, TRY, USD). |
const outOfStock = skinport.getOutOfStock({ app_id: 730, currency: "EUR" });
console.log(outOfStock);Retrieves a paginated list of user account transactions, including details.
- options: object (optional)
Authorization: Required
| Property | Type | Required | Description |
|---|---|---|---|
| page | number | Optional | Pagination Page (default 1). |
| limit | number | Optional | Limit results between 1 and 100 (default 100). |
| order | string | Optional | Order results by asc or desc (default desc). |
const salesHistory = skinport.getSalesHistory({ market_hash_name: "Glove Case,★ Karambit | Slaughter (Minimal Wear)", app_id: 730, currency: "EUR" });
console.log(salesHistory);