Upgrader API Routes Documentation

The Upgrader API provides REST endpoints for managing and retrieving inventory items used in the upgrader game mode.

Overview

The upgrader allows users to bet an amount to upgrade to a more expensive item based on calculated win chances with a house edge.

Base Path: /upgrader


Endpoints

1. GET /upgrader/items

Get all inventory items with caching. Returns items sorted by price in descending order.

Query Parameters

None.

Response

Returns an array of item objects, filtered to only include items with valid prices (> $0).

Array<{
    appid: number;
    marketHashName: string;
    gunName: string;
    skinName: string;
    image: string;
    price: string;
    nextPriceFetch: number;
}>;

Example Request

Example Response

Notes

  • Uses in-memory caching with 1-hour duration

  • Automatically filters out items without prices or with price ≤ $0

  • Items are sorted by price in descending order (most expensive first)


2. GET /upgrader/items/pagination

Get paginated inventory items with search and sorting capabilities.

Query Parameters

Parameter
Type
Default
Description

page

number

1

Page number for pagination (minimum: 1)

limit

number

18

Number of items per page

sort

string

"Descending"

Sort order by price: "Ascending" or "Descending"

search

string

""

Search term to filter items by gun name or skin name (case-insensitive)

Response

Example Request

Example Response

Notes

  • Search is performed across both gunName and skinName fields

  • Search is case-insensitive

  • Items without valid prices (null or ≤ $0) are automatically filtered out

  • Sorting is applied after filtering and searching


Data Models

Item Object

Inventory Database Schema


Error Handling

All endpoints include comprehensive error handling:

  • 200: Success

  • 500: Internal Server Error (database or network issues)

Error responses follow this format:


Frontend Integration

Example: Fetching All Items

Last updated