{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cspriceapi-com/json-schema/cspriceapi-com-price-history-response-schema.json",
  "title": "PriceHistoryResponse",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cspriceapi-com-price-history-api-openapi.yml#/components/schemas/PriceHistoryResponse",
  "allOf": [
    {
      "$ref": "#/$defs/BaseWrapper"
    },
    {
      "type": "object",
      "properties": {
        "market": {
          "type": "string"
        },
        "market_hash_name": {
          "type": "string"
        },
        "resolution": {
          "type": "string",
          "enum": [
            "hourly",
            "daily"
          ]
        },
        "currency": {
          "type": "string",
          "enum": [
            "CNY",
            "EUR",
            "USD"
          ]
        },
        "from": {
          "type": "string",
          "format": "date"
        },
        "to": {
          "type": "string",
          "format": "date"
        },
        "count": {
          "type": "integer"
        },
        "data": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "$ref": "#/$defs/PriceHistoryPointDaily"
              },
              {
                "$ref": "#/$defs/PriceHistoryPointHourly"
              }
            ]
          }
        },
        "source": {
          "type": "string"
        }
      },
      "required": [
        "market",
        "market_hash_name",
        "resolution",
        "currency",
        "from",
        "to",
        "count",
        "data"
      ]
    }
  ],
  "$defs": {
    "BaseWrapper": {
      "type": "object",
      "description": "Envelope fields returned by every `GET /v1/prices/*` response.",
      "properties": {
        "source": {
          "type": "string",
          "description": "Human-readable marketplace identifier."
        },
        "requestor": {
          "type": "string",
          "format": "email",
          "description": "Email address associated with the API key making the call."
        },
        "plan": {
          "type": "string",
          "description": "Plan of the API key (e.g. `free`, `pro`, `enterprise`)."
        },
        "timestamp": {
          "allOf": [
            {
              "$ref": "#/$defs/UpdatedAt"
            }
          ],
          "description": "Server time when this response was produced."
        }
      },
      "required": [
        "source",
        "timestamp"
      ]
    },
    "DecimalString": {
      "type": "string",
      "description": "Fixed-point decimal value serialized as a string (preserves precision\nacross languages). Parse with an arbitrary-precision decimal library;\ndo **not** parse as a native float.\n",
      "pattern": "^-?\\d+(\\.\\d+)?$"
    },
    "PriceHistoryPointDaily": {
      "type": "object",
      "properties": {
        "day": {
          "type": "string",
          "format": "date"
        },
        "price": {
          "allOf": [
            {
              "$ref": "#/$defs/DecimalString"
            }
          ],
          "nullable": true
        },
        "count": {
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "required": [
        "day"
      ]
    },
    "PriceHistoryPointHourly": {
      "type": "object",
      "properties": {
        "day": {
          "type": "string",
          "format": "date"
        },
        "slot": {
          "type": "integer",
          "description": "Hourly bucket index within the day (0–23)."
        },
        "last_ts": {
          "type": "string"
        },
        "price": {
          "allOf": [
            {
              "$ref": "#/$defs/DecimalString"
            }
          ],
          "nullable": true
        },
        "count": {
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "required": [
        "day",
        "slot"
      ]
    },
    "UpdatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO-8601 UTC timestamp (millisecond precision)."
    }
  }
}