{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/axonflow/json-schema/axonflow-budget-schema.json",
  "title": "Budget",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/axonflow-cost-controls-api-openapi.yml#/components/schemas/Budget",
  "type": "object",
  "required": [
    "id",
    "name",
    "scope",
    "limit_usd",
    "period"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique budget identifier"
    },
    "name": {
      "type": "string",
      "description": "Human-readable budget name"
    },
    "enabled": {
      "type": "boolean",
      "default": true,
      "description": "When false the budget is configured but its limit is not\nenforced — usage is still tracked. Lets operators dry-run\na budget before flipping it on.\n"
    },
    "scope": {
      "type": "string",
      "enum": [
        "organization",
        "team",
        "agent",
        "workflow",
        "user"
      ],
      "description": "Budget scope level"
    },
    "scope_id": {
      "type": "string",
      "description": "ID of the scoped entity (team_id, agent_id, etc.)"
    },
    "limit_usd": {
      "type": "number",
      "format": "double",
      "description": "Maximum spending limit in USD"
    },
    "period": {
      "type": "string",
      "enum": [
        "daily",
        "weekly",
        "monthly",
        "quarterly",
        "yearly"
      ],
      "description": "Budget reset period"
    },
    "on_exceed": {
      "type": "string",
      "enum": [
        "warn",
        "block",
        "downgrade"
      ],
      "default": "warn",
      "description": "Action when budget is exceeded"
    },
    "alert_thresholds": {
      "type": "array",
      "items": {
        "type": "integer"
      },
      "description": "Percentage thresholds for alerts (e.g., [50, 80, 100])"
    },
    "org_id": {
      "type": "string",
      "description": "Organization ID"
    },
    "tenant_id": {
      "type": "string",
      "description": "Tenant ID (multi-tenant deployments)"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    }
  }
}