{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/divvy/json-schema/divvy-bill-approval-policy-request-dto-schema.json",
  "title": "BillApprovalPolicyRequestDto",
  "description": "Create a bill approval policy",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/divvy-bill-approvals-api-openapi.yml#/components/schemas/BillApprovalPolicyRequestDto",
  "required": [
    "approvers",
    "policyName",
    "rules"
  ],
  "type": "object",
  "properties": {
    "policyName": {
      "type": "string",
      "description": "Bill approval policy name"
    },
    "rules": {
      "type": "array",
      "description": "Bill approval policy rules. You can set multiple rules for a policy.\n\n**Note**: Policy rules are applied in the specified order.",
      "items": {
        "$ref": "#/$defs/BillApprovalPolicyCreateRuleDto"
      }
    },
    "approvers": {
      "type": "array",
      "description": "List of approvers. For each approver, set the BILL-generated ID of the user. The value begins with `006`.\n\n**Note**: BILL requests approvals in the specified order.",
      "items": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "BillApprovalPolicyCreateRuleDto": {
      "type": "object",
      "properties": {
        "key": {
          "allOf": [
            {
              "$ref": "#/$defs/RuleKeyCreateDto"
            },
            {
              "description": "Rule key.\n\n**Note**: Currently, only `BILL_AMOUNT` is supported with the API."
            }
          ]
        },
        "op": {
          "allOf": [
            {
              "$ref": "#/$defs/RuleOperatorCreateDto"
            },
            {
              "description": "Rule operator.\n* `lt`: Less than\n* `gte`: Greater than or equal to\n* `in`: Any value in a list\n"
            }
          ]
        },
        "values": {
          "type": "array",
          "description": "Rule values",
          "items": {
            "type": "string"
          }
        }
      },
      "description": "Rules for a bill approval policy."
    },
    "RuleKeyCreateDto": {
      "type": "string",
      "description": "Keys for approval rules.",
      "enum": [
        "BILL_AMOUNT",
        "BILL_LINE_ITEM_AMOUNT",
        "CHART_OF_ACCOUNT_ID",
        "VENDOR_ID"
      ]
    },
    "RuleOperatorCreateDto": {
      "type": "string",
      "description": "Operators for approval rules.",
      "enum": [
        "lt",
        "gte",
        "in"
      ]
    }
  }
}