{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/spendline-ai/json-schema/spendline-ai-budget-schema.json",
  "title": "Budget",
  "description": "A hierarchical budget. The tightest applicable scope wins.",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/spendline-ai-openapi.json#/components/schemas/Budget",
  "type": "object",
  "required": [
    "scope_type",
    "monthly_limit_usd"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "readOnly": true
    },
    "scope_type": {
      "type": "string",
      "enum": [
        "org",
        "team",
        "agent",
        "customer"
      ],
      "description": "org = whole account. team = x-spendline-tags cost-centre key. agent = x-agent-id. customer = x-customer-id."
    },
    "scope_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Required unless scope_type is \"org\". Must match the attribution value exactly."
    },
    "monthly_limit_usd": {
      "type": "number",
      "minimum": 0,
      "description": "Calendar-month cap in USD, UTC."
    },
    "strict_mode": {
      "type": "boolean",
      "description": "true blocks over-cap calls with 402; false records only."
    },
    "require_approval_on_exceed": {
      "type": "boolean"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "readOnly": true
    }
  }
}