{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/envestnet/json-schema/envestnet-transaction-categorization-rule-request-schema.json",
  "title": "TransactionCategorizationRuleRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/envestnet-transactions-api-openapi.yml#/components/schemas/TransactionCategorizationRuleRequest",
  "required": [
    "rule"
  ],
  "type": "object",
  "properties": {
    "rule": {
      "$ref": "#/$defs/TransactionCategorizationRuleInfo"
    }
  },
  "$defs": {
    "FieldOperation": {
      "title": "FieldOperation",
      "type": "object",
      "properties": {
        "field": {
          "type": "string",
          "description": "Field for which the clause is created.<br><br><b>Applicable containers</b>: bank, creditCard, investment, insurance, loan<br><b>Applicable Values</b>:<ul><li>amount</li><li>description</li></ul><b>Applicable Values</b><br>",
          "enum": [
            "amount",
            "description"
          ]
        },
        "operation": {
          "type": "string",
          "description": "Operation for which the clause is created.<br><br><b>Applicable containers</b>: bank, creditCard, investment, insurance, loan<br><b>Applicable values (depends on the value of field)</b>:<ul><li>field is <b>description</b> -> operation can be<ol><li>stringEquals</li><li>stringContains</li></ol></li><li>field is <b>amount</b> -> operation can be<ol><li>numberEquals</li><li>numberLessThan</li><li>numberLessThanEquals</li><li>numberGreaterThan</li><li>numberGreaterThanEquals</li></ol></li></ul><b>Applicable Values</b><br>",
          "enum": [
            "numberEquals",
            "numberLessThan",
            "numberLessThanEquals",
            "numberGreaterThan",
            "numberGreaterThanEquals",
            "stringEquals",
            "stringContains"
          ]
        },
        "value": {
          "type": "object",
          "properties": {},
          "description": "The value would be the amount value in case of amount based rule clause or the string value in case of description based rule clause.<br><br><b>Applicable containers</b>: bank, creditCard, investment, insurance, loan<br><b>Applicable Values</b>:<ul><li>field is <b>description</b> -> value should be <b>min of 3 and max of 50 characters</b></li><li>field is <b>amount</b> -> value should be <b> min value of 0 and a max value of 99999999999.99</b></li></ul>"
        }
      }
    },
    "TransactionCategorizationRuleInfo": {
      "title": "TransactionCategorizationRuleInfo",
      "required": [
        "categoryId",
        "ruleClause"
      ],
      "type": "object",
      "properties": {
        "ruleClause": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FieldOperation"
          }
        },
        "source": {
          "type": "string",
          "enum": [
            "SYSTEM",
            "USER"
          ]
        },
        "priority": {
          "type": "integer",
          "format": "int32"
        },
        "categoryId": {
          "type": "integer",
          "format": "int32"
        }
      }
    }
  }
}