{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hud-ai/json-schema/hud-ai-spend-limit-item-schema.json",
  "title": "SpendLimitItem",
  "description": "One limit with its current spend-window total.\n\nAPI-key and membership limits use their corresponding ID. Team limits have\nneither; percentage alerts additionally identify their parent team limit.\n``period_start`` is the window opening (calendar start or last reset);\n``period_end`` is the next calendar boundary.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hud-ai-limits-api-openapi.yml#/components/schemas/SpendLimitItem",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "title": "Id"
    },
    "api_key_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Api Key Id"
    },
    "api_key_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Api Key Name"
    },
    "membership_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Membership Id"
    },
    "member_name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Member Name"
    },
    "parent_limit_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Parent Limit Id"
    },
    "threshold_percent": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Threshold Percent"
    },
    "interval": {
      "$ref": "#/$defs/SpendInterval"
    },
    "amount_usd": {
      "type": "string",
      "title": "Amount Usd"
    },
    "action": {
      "$ref": "#/$defs/SpendLimitAction"
    },
    "enabled": {
      "type": "boolean",
      "title": "Enabled"
    },
    "spend_usd": {
      "type": "string",
      "title": "Spend Usd"
    },
    "period_start": {
      "type": "string",
      "title": "Period Start"
    },
    "period_end": {
      "type": "string",
      "title": "Period End"
    },
    "reset_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reset At"
    },
    "editable": {
      "type": "boolean",
      "title": "Editable"
    }
  },
  "type": "object",
  "required": [
    "id",
    "api_key_id",
    "api_key_name",
    "membership_id",
    "member_name",
    "parent_limit_id",
    "threshold_percent",
    "interval",
    "amount_usd",
    "action",
    "enabled",
    "spend_usd",
    "period_start",
    "period_end",
    "reset_at",
    "editable"
  ],
  "$defs": {
    "SpendInterval": {
      "type": "string",
      "enum": [
        "week",
        "month"
      ],
      "title": "SpendInterval"
    },
    "SpendLimitAction": {
      "type": "string",
      "enum": [
        "alert",
        "block"
      ],
      "title": "SpendLimitAction"
    }
  }
}