Build a CS2 price Discord bot

A /price command that answers with the cheapest marketplace and a link to the full chart on Skinstrack. Built with discord.js v14 and the official skinstrack SDK.

Stack
Node.js 18+, discord.js v14
Plan
Paid (Standard and up)
Data
34+ marketplaces, refreshed ~15 min
  1. 1

    Get a free Skinstrack API key

    Sign in with Steam on skinstrack.com and create a key in the dashboard. The free plan gives 50 requests a month on Steam prices with no card. Paid plans from $24.99 a month unlock all 34+ marketplaces. Keep the key in an environment variable, never in source code.

    terminal
    bash
    export SKINSTRACK_API_KEY=your-api-key
  2. 2

    Install dependencies

    Create a bot in the Discord developer portal, copy its token and application id, then install the two packages.

    terminal
    bash
    npm install discord.js skinstrack
  3. 3

    Write the bot

    The bot registers /price on startup, looks the skin up with getItem and replies with an embed. The skinstrack_url field in the response links straight to the skin's page with history and alerts.

    bot.mjs
    js
    import { Client, EmbedBuilder, Events, GatewayIntentBits, REST, Routes, SlashCommandBuilder } from "discord.js";
    import { NotFoundError } from "skinstrack";
    import { SkinstracksV2 } from "skinstrack/v2";
    
    const skinstrack = new SkinstracksV2({ apiKey: process.env.SKINSTRACK_API_KEY });
    
    const command = new SlashCommandBuilder()
      .setName("price")
      .setDescription("Live CS2 skin price across 34+ marketplaces")
      .addStringOption((o) => o.setName("skin").setDescription("e.g. AK-47 | Redline (Field-Tested)").setRequired(true));
    
    const rest = new REST().setToken(process.env.DISCORD_TOKEN);
    await rest.put(Routes.applicationCommands(process.env.DISCORD_APP_ID), { body: [command.toJSON()] });
    
    const client = new Client({ intents: [GatewayIntentBits.Guilds] });
    
    client.on(Events.InteractionCreate, async (interaction) => {
      if (!interaction.isChatInputCommand() || interaction.commandName !== "price") return;
      await interaction.deferReply();
    
      try {
        const item = await skinstrack.getItem(interaction.options.getString("skin", true));
        const top = [...item.prices].sort((a, b) => a.price - b.price).slice(0, 5);
    
        const embed = new EmbedBuilder()
          .setTitle(item.market_hash_name)
          .setURL(item.skinstrack_url)
          .setDescription(top.map((p) => `**${p.provider}** $${p.price.toFixed(2)}`).join("\n"))
          .setFooter({ text: "Prices by Skinstrack" });
    
        await interaction.editReply({ embeds: [embed] });
      } catch (error) {
        const message = error instanceof NotFoundError ? "Skin not found." : "Price lookup failed.";
        await interaction.editReply(message);
      }
    });
    
    client.login(process.env.DISCORD_TOKEN);
  4. 4

    Run it

    Set the three environment variables and start the bot. Each /price call uses one API request.

    terminal
    bash
    export DISCORD_TOKEN=... DISCORD_APP_ID=... SKINSTRACK_API_KEY=...
    node bot.mjs

Ready to run it?

Get a Skinstrack API key in a minute. Free tier: 50 requests per month on Steam prices, no card required.

Get your API key

Frequently Asked Questions

CS2 skin prices, the Skinstrack API and the tools around it.

How many API requests does the Discord bot use?

One per /price command. For a busy server, fetch /v2/paid/items on a schedule and answer from memory instead.

Can the bot post price alerts instead?

Yes. Skinstrack price alerts can be delivered to Discord directly. Create them with client.createAlert or from the Skinstrack dashboard.

Can the bot show prices in another currency?

Pass { currency: 'EUR' } (or any ISO 4217 code) as the second argument to getItem.

More Skinstrack API examples

skinstrack.com

Want full price tracking, charts and alerts?

cs2skinsapi.com shows a quick price. Skinstrack is the full platform behind it, free to use, with everything a CS2 trader or developer needs.

  • Prices from 34+ marketplaces on every skin
  • Daily price history charts and market trends
  • Price alerts by email, Discord or Telegram
  • Portfolio and Steam inventory tracking
  • Free Chrome extension for Steam
  • Trade-up, case ROI and loadout tools