{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tickfeed-pro/json-schema/tickfeed-pro-usage-response-schema.json",
  "title": "UsageResponse",
  "x-generated": "2026-10-31",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tickfeed-pro-openapi.json#/components/schemas/UsageResponse",
  "properties": {
    "billing": {
      "type": "string",
      "enum": [
        "prepaid",
        "internal"
      ],
      "title": "Billing",
      "description": "internal = operator key, never charged"
    },
    "currency": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Currency",
      "description": "Account currency (usd, gbp, eur); null for internal keys"
    },
    "balance": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Balance",
      "description": "Current balance, formatted, e.g. $12.50"
    },
    "balance_micros": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Balance Micros",
      "description": "Current balance in millionths of the currency"
    },
    "unit_price": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Unit Price",
      "description": "Price of one billing unit, e.g. $0.002"
    },
    "unit_price_micros": {
      "type": "integer",
      "title": "Unit Price Micros"
    },
    "candles_per_unit": {
      "type": "integer",
      "title": "Candles Per Unit",
      "description": "Candle requests cost one unit per this many bars returned"
    },
    "ticks_per_unit": {
      "type": "integer",
      "title": "Ticks Per Unit",
      "description": "Tick requests cost one unit per this many ticks returned",
      "default": 1000
    },
    "requests_per_minute": {
      "type": "integer",
      "title": "Requests Per Minute"
    },
    "spent_30d": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Spent 30D"
    },
    "spent_30d_micros": {
      "type": "integer",
      "title": "Spent 30D Micros"
    },
    "billable_requests_30d": {
      "type": "integer",
      "title": "Billable Requests 30D"
    },
    "history": {
      "items": {
        "$ref": "#/$defs/UsageDay"
      },
      "type": "array",
      "title": "History",
      "description": "Spend per UTC day with billable requests, last 30 days"
    }
  },
  "type": "object",
  "required": [
    "billing",
    "currency",
    "balance",
    "balance_micros",
    "unit_price",
    "unit_price_micros",
    "candles_per_unit",
    "requests_per_minute",
    "spent_30d",
    "spent_30d_micros",
    "billable_requests_30d",
    "history"
  ],
  "$defs": {
    "UsageDay": {
      "properties": {
        "day": {
          "type": "string",
          "title": "Day"
        },
        "requests": {
          "type": "integer",
          "title": "Requests",
          "description": "Billable requests that day"
        },
        "spent": {
          "type": "string",
          "title": "Spent",
          "description": "Amount spent that day, formatted in the account currency"
        },
        "spent_micros": {
          "type": "integer",
          "title": "Spent Micros",
          "description": "Amount spent that day, in millionths of the account currency"
        }
      },
      "type": "object",
      "required": [
        "day",
        "requests",
        "spent",
        "spent_micros"
      ],
      "title": "UsageDay"
    }
  }
}