{
  "openapi": "3.0.3",
  "info": {
    "title": "MarketDB Public API",
    "description": "Free public REST API of marketdb.info – Steam Community Market analytics database. JSON responses, GET-only, no auth. Rate-limited per IP: 429 means rate limit or busy server, retry after the Retry-After seconds. 503 means site maintenance.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://marketdb.info"
    },
    {
      "url": "/"
    }
  ],
  "paths": {
    "/api/v1/exchange-rates": {
      "get": {
        "summary": "Steam wallet exchange rates (current or historical)",
        "description": "Rate set for all 39 Steam wallet currencies. Same payload as the Download JSON button on the /api page. Optional base re-bases all rates to another currency (default USD). Optional date returns the historical rate set effective on that calendar day (carry-forward on weekends; history starts 2025-10-21).",
        "parameters": [
          {
            "name": "base",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "EUR"
            },
            "description": "ISO currency code to re-base rates to (must be one of the 39 Steam wallet currencies)."
          },
          {
            "name": "date",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2026-01-15"
            },
            "description": "Calendar day (YYYY-MM-DD) to return historical rates for. Weekends and gaps carry the last business day rate forward. History starts 2025-10-21."
          }
        ],
        "responses": {
          "200": {
            "description": "Rate set",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExchangeRates"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/api/v1/sale": {
      "get": {
        "summary": "Rebuild original Steam sale JSON",
        "description": "Rebuilds the original Steam Market sale JSON if the sale is stored in MarketDB. The response is always an array of full sale objects, a single sale comes as one element. Pass EXACTLY ONE of listing_id or asset_id. By listing_id: a stack listing bought by several buyers returns one entry per purchase. By asset_id (the item id from a Steam inventory): rebuilds the same sale JSON. After a sale Steam rewrites the asset_id, the lookup works with both the current and any previous asset_id. If the asset was bought and later resold, every sale comes back in one array, oldest first. By asset_id an optional game parameter narrows the search to one game, since the same asset_id can exist in several games.",
        "parameters": [
          {
            "name": "listing_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,20}$"
            },
            "description": "Steam Market listing id."
          },
          {
            "name": "asset_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^\\d{1,20}$"
            },
            "description": "Steam asset id (e.g. from an inventory)."
          },
          {
            "name": "game",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "enum": [
                440,
                570,
                730,
                753,
                590830
              ]
            },
            "description": "Optional app id filter, valid only together with asset_id. An asset_id is unique only within one game and the same id can belong to items from different games, in which case every match is returned. This parameter narrows the search to a single game."
          }
        ],
        "responses": {
          "200": {
            "description": "Array of original Steam sale objects (listinginfo / purchaseinfo / assets)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SteamSale"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v1/items": {
      "get": {
        "summary": "Full item catalog of a game",
        "description": "market_hash_name + market_name pairs for every item of the game. Data refreshes as new unique records reach the database.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Game"
          }
        ],
        "responses": {
          "200": {
            "description": "Item catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemsCatalog"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/api/v1/buckets": {
      "get": {
        "summary": "Skin-family (bucket) catalog",
        "description": "market_bucket_group_id + market_bucket_group_name pairs – Steam's \"similar items\" grouping. CS2 (730) only. Other games return an empty list.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Game"
          }
        ],
        "responses": {
          "200": {
            "description": "Bucket catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BucketsCatalog"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/api/v1/prices": {
      "get": {
        "summary": "Per-item market stats",
        "description": "Sales count, average / median / min / max unit price, volume and last price. Without market_hash_name it returns every item of the game, with it a single item. hours omitted = all time (24 has no min/max/last: the hourly aggregate does not store them). currency converts every money field at the current exchange rate. The code, ids and rate are stated once in the header.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Game"
          },
          {
            "name": "market_hash_name",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 256
            }
          },
          {
            "name": "hours",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "enum": [
                24,
                168,
                720
              ]
            },
            "description": "Window: 24 = day, 168 = week, 720 = month. Omitted = all time."
          },
          {
            "name": "currency",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "USD",
              "example": "RUB"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Price list (no market_hash_name) or single-item stats (with it)",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/PriceList"
                    },
                    {
                      "$ref": "#/components/schemas/PriceItemSingle"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v1/attrs": {
      "get": {
        "summary": "Attribute catalog with prices",
        "description": "Traits parsed from the descriptions of sold items: CS2 (730) stickers, charms and patches, Dota 2 (570) gems. Every entry carries the sales count and two prices. avg_price is the average sale price of items carrying the attribute. est_price is the estimated value of the attribute for entries that have no avg_price. Prices are numbers or null when there is no data.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Game"
          }
        ],
        "responses": {
          "200": {
            "description": "Attribute catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttrsCatalog"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    },
    "/api/v1/antiscam": {
      "get": {
        "summary": "Items flagged by the anti-scam pipeline",
        "description": "All-time statistics on items used for scam transfers (wash trading and price pumping). Detection covers TF2 (440) and Dota 2 (570). Other games return an empty list.",
        "parameters": [
          {
            "$ref": "#/components/parameters/Game"
          }
        ],
        "responses": {
          "200": {
            "description": "Flagged items",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AntiscamCatalog"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "Game": {
        "name": "game",
        "in": "query",
        "required": true,
        "schema": {
          "type": "integer",
          "enum": [
            440,
            570,
            730,
            753,
            590830
          ]
        },
        "description": "Steam appid: 440 = TF2, 570 = Dota 2, 730 = CS2, 753 = Steam, 590830 = s&box."
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Invalid parameters",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "Nothing found",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ]
      },
      "ExchangeRates": {
        "type": "object",
        "properties": {
          "timestamp": {
            "type": "integer",
            "description": "ms epoch – when the rate set took effect (21:00 UTC)"
          },
          "last_checked": {
            "type": "integer",
            "nullable": true,
            "description": "ms epoch – last successful rate check"
          },
          "base": {
            "type": "string",
            "example": "USD"
          },
          "rates": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "currency_id": {
                  "type": "integer",
                  "description": "Steam wallet currency id (1..41)"
                },
                "market_id": {
                  "type": "integer",
                  "description": "Currency id in Steam Market data (2000 + currency_id)"
                },
                "code": {
                  "type": "string",
                  "example": "RUB"
                },
                "symbol": {
                  "type": "string",
                  "example": "руб"
                },
                "rate": {
                  "type": "number",
                  "nullable": true,
                  "description": "1 base unit in this currency"
                }
              }
            }
          }
        }
      },
      "SteamSale": {
        "type": "object",
        "description": "Original Steam sale JSON reconstructed from the database: success, timestamp, listinginfo, purchaseinfo and assets keyed exactly like Steam's own payloads.",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "timestamp": {
            "type": "integer",
            "description": "ms epoch of the sale"
          },
          "listinginfo": {
            "type": "object",
            "additionalProperties": true
          },
          "purchaseinfo": {
            "type": "object",
            "additionalProperties": true
          },
          "assets": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "ItemsCatalog": {
        "type": "object",
        "properties": {
          "game": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "updated": {
            "type": "integer",
            "description": "ms epoch – when the newest item record appeared"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "market_hash_name": {
                  "type": "string"
                },
                "market_name": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "BucketsCatalog": {
        "type": "object",
        "properties": {
          "game": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "updated": {
            "type": "integer"
          },
          "buckets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "market_bucket_group_id": {
                  "type": "string"
                },
                "market_bucket_group_name": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "PriceRow": {
        "type": "object",
        "properties": {
          "market_hash_name": {
            "type": "string"
          },
          "sales": {
            "type": "integer"
          },
          "avg_price": {
            "type": "number",
            "nullable": true
          },
          "median_price": {
            "type": "number",
            "nullable": true
          },
          "min_price": {
            "type": "number",
            "nullable": true
          },
          "max_price": {
            "type": "number",
            "nullable": true
          },
          "volume": {
            "type": "number",
            "nullable": true,
            "description": "Total sales volume in the requested currency"
          },
          "last_price": {
            "type": "number",
            "nullable": true
          }
        }
      },
      "PriceHeader": {
        "type": "object",
        "properties": {
          "game": {
            "type": "integer"
          },
          "hours": {
            "type": "integer",
            "nullable": true,
            "description": "null = all time"
          },
          "currency": {
            "type": "string"
          },
          "currency_id": {
            "type": "integer"
          },
          "market_id": {
            "type": "integer"
          },
          "rate": {
            "type": "number",
            "description": "USD → currency rate applied"
          }
        }
      },
      "PriceList": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PriceHeader"
          },
          {
            "type": "object",
            "properties": {
              "count": {
                "type": "integer"
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PriceRow"
                }
              }
            }
          }
        ]
      },
      "PriceItemSingle": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PriceHeader"
          },
          {
            "$ref": "#/components/schemas/PriceRow"
          }
        ]
      },
      "AttrsCatalog": {
        "type": "object",
        "properties": {
          "game": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "updated": {
            "type": "integer"
          },
          "attrs": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "sticker / charm / patch for CS2, gem type for Dota 2"
                },
                "name": {
                  "type": "string"
                },
                "variant": {
                  "type": "string"
                },
                "tournament": {
                  "type": "string"
                },
                "sales_count": {
                  "type": "integer"
                },
                "items_count": {
                  "type": "integer"
                },
                "avg_price": {
                  "type": "number",
                  "nullable": true
                },
                "est_price": {
                  "type": "number",
                  "nullable": true
                },
                "image_url": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "AntiscamCatalog": {
        "type": "object",
        "properties": {
          "game": {
            "type": "integer"
          },
          "count": {
            "type": "integer"
          },
          "updated": {
            "type": "integer",
            "description": "ms epoch of the newest flagged sale"
          },
          "items": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "market_hash_name": {
                  "type": "string"
                },
                "market_name": {
                  "type": "string"
                },
                "flagged_sales": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    }
  }
}