{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/onclarity-com/json-schema/onclarity-com-budget-create-request-schema.json",
  "title": "BudgetCreateRequest",
  "description": "Create body — also the validator a PATCH is re-run through after merging.\n\nRules: ``scope='global'`` ⇔ no ``project_id``; ``period='custom'`` ⇔ both bounds present\n(and ``custom_to > custom_from``); ``surfaces`` is omitted (all) or a non-empty subset\nof the known surfaces (deduped, sorted); naive datetimes are read as UTC.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/onclarity-com-agent-costs-api-openapi.yml#/components/schemas/BudgetCreateRequest",
  "properties": {
    "name": {
      "type": "string",
      "maxLength": 120,
      "minLength": 1,
      "title": "Name",
      "description": "Display name"
    },
    "scope": {
      "type": "string",
      "enum": [
        "global",
        "project"
      ],
      "title": "Scope"
    },
    "project_id": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Project Id"
    },
    "period": {
      "type": "string",
      "enum": [
        "day",
        "week",
        "month",
        "custom"
      ],
      "title": "Period",
      "default": "day"
    },
    "custom_from": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Custom From"
    },
    "custom_to": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Custom To"
    },
    "surfaces": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Surfaces",
      "description": "None = all surfaces"
    },
    "lens": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "internal",
            "tenant"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Lens",
      "description": "None = all spend"
    },
    "usd_threshold": {
      "anyOf": [
        {
          "type": "number",
          "exclusiveMinimum": 0.0
        },
        {
          "type": "string",
          "pattern": "^(?!^[-+.]*$)[+-]?0*(?:\\d{0,10}|(?=[\\d.]{1,13}0*$)\\d{0,10}\\.\\d{0,2}0*$)"
        }
      ],
      "title": "Usd Threshold"
    },
    "enabled": {
      "type": "boolean",
      "title": "Enabled",
      "default": true
    }
  },
  "type": "object",
  "required": [
    "name",
    "scope",
    "usd_threshold"
  ]
}