Skip to content

Price Recommendations API

This documentation explains how to use the getPriceRecommendations GraphQL query to fetch price recommendations for items in different games.

Authentication

All API requests require authentication using a JWT token. Include the following header in your requests:

HeaderValueDescription
api-token<generated_jwt>Your JWT authentication token

For information on how to generate your JWT token, please refer to the Authentication Guide.

Query

graphql
query PriceRecommendations($game_id: Int, $type: RecommendationType) {
  getPriceRecommendations(game_id: $game_id, type: $type) {
    market_hash_name
    suggested_price
    unstable_reasons
    total_sales
    price_difference
    price_change_percentage
  }
}

Variables

json
{
  "game_id": 730,
  "type": "general"
}

Parameters

ParameterTypeDescriptionRequired
game_idIntegerThe ID of the game. Supported values: 730 (CS:GO), 440 (Team Fortress 2), 570 (Dota 2), 252490 (Rust)No (default: 730)
typeRecommendationTypeType of price recommendation. (Which type of markets used to generate recommendation) Possible values: general (all supported markets excluding gambling ones), p2p (supported P2P markets)No (default: general)

Response Fields

FieldTypeDescription
market_hash_nameStringThe unique identifier of the item
suggested_priceIntegerThe recommended price for the item (actual price can be obtained via division by 1000)
unstable_reasons[UnstableReason]List of reasons why the price might be unstable
total_salesIntegerTotal number of sales for this item
price_differenceFloatDifference between current and suggested price
price_change_percentageFloatPercentage change in price

RecommendationType Enum

The type parameter accepts the following values:

typescript
enum RecommendationType {
  general = 'general',       // All supported markets excluding gambling ones
  p2p = 'p2p'                // Supported P2P markets only
}

UnstableReason Enum

The unstable_reasons field may contain one or more of the following values:

typescript
enum UnstableReason {
  NOT_POPULAR = 'NOT_POPULAR',         // Item is not traded frequently
  NO_ORDERS = 'NO_ORDERS',             // No buy orders exist for this item
  NO_LISTINGS = 'NO_LISTINGS',         // No sell listings exist for this item
  LISTINGS_PRICE = 'LISTINGS_PRICE',   // Unusual pricing in listings
  BIG_LISTINGS_DIFFERENCE = 'BIG_LISTINGS_DIFFERENCE', // Large price gap between listings
  BOOST_RISK = 'BOOST_RISK',           // Risk of price manipulation
  NO_THREE_MONTH_SALES = 'NO_THREE_MONTH_SALES', // No sales in the last three months
  THREE_MONTH_SALES = 'THREE_MONTH_SALES', // Sales data limited to past three months
}

Example Usage

graphql
query PriceRecommendations($game_id: Int, $type: RecommendationType) {
  getPriceRecommendations(game_id: $game_id, type: $type) {
    market_hash_name
    suggested_price
    unstable_reasons
    total_sales
    price_difference
    price_change_percentage
  }
}

Variables:

json
{
  "game_id": 730,
  "type": "general"
}

Code Examples

js
const axios = require('axios');

async function getPriceRecommendations(gameId = 730, type = 'general') {
  const query = `
    query PriceRecommendations($game_id: Int, $type: RecommendationType) {
      getPriceRecommendations(game_id: $game_id, type: $type) {
        market_hash_name
        suggested_price
        unstable_reasons
        total_sales
        price_difference
        price_change_percentage
      }
    }
  `;

  try {
    const response = await axios({
      url: 'https://api.csmarketcap.com/api/v2/graphql',
      method: 'post',
      headers: {
        'Content-Type': 'application/json',
        'api-token': 'YOUR_JWT_TOKEN_HERE'
      },
      data: {
        query: query,
        variables: {
          game_id: gameId,
          type: type
        }
      }
    });

    console.log('Price recommendations:', response.data.data.getPriceRecommendations);
    return response.data.data.getPriceRecommendations;
  } catch (error) {
    console.error('Error fetching price recommendations:', error);
  }
}

getPriceRecommendations();
bash
curl -X POST https://api.csmarketcap.com/api/v2/graphql \
  -H "Content-Type: application/json" \
  -H "api-token: YOUR_JWT_TOKEN_HERE" \
  -d '{
    "query": "query PriceRecommendations($game_id: Int, $type: RecommendationType) { getPriceRecommendations(game_id: $game_id, type: $type) { market_hash_name suggested_price unstable_reasons total_sales price_difference price_change_percentage } }",
    "variables": {
      "game_id": 730,
      "type": "general"
    }
  }'

Example Response

json
{
  "data": {
    "getPriceRecommendations": [
      {
        "market_hash_name": "AK-47 | Redline (Field-Tested)",
        "suggested_price": 1245, // 12.45$
        "unstable_reasons": [],
        "total_sales": 1245,
        "price_difference": 0.15,
        "price_change_percentage": 1.22
      },
      {
        "market_hash_name": "AWP | Asiimov (Field-Tested)",
        "suggested_price": 3467, // 34.67$
        "unstable_reasons": ["BIG_LISTINGS_DIFFERENCE"],
        "total_sales": 897,
        "price_difference": -1.23,
        "price_change_percentage": -3.43
      }
    ]
  }
}

Need help? Contact our support team