{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/adobe/json-schema/adobe-criteria-item-schema.json",
  "title": "CriteriaItem",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/adobe-target-recommendations-openapi.yml#/components/schemas/CriteriaItem",
  "allOf": [
    {
      "$ref": "#/$defs/CriteriaMin"
    },
    {
      "type": "object",
      "properties": {
        "aggregation": {
          "type": "string",
          "enum": [
            "NONE",
            "AGGREGATE",
            "ALL_OR_NOTHING"
          ],
          "default": "NONE",
          "description": "Whether recommendations should be shown solely based on the key (`NONE`) or visitor's behavioral history with\nrespect to the key (`AGGREGATE`, `ALL_OR_NOTHING`).\n\n  - `NONE` implies no aggregation, to only show recommendations for the given key.\n  - `AGGREGATE` begins with recommendations for the given key, last viewed item, for instance, then continues to\n    next last viewed item by visitor until the design is filled.\n  - `ALL_OR_NOTHING` is similar to aggregation but the aggregation only happens if the given key, last purchased\n    item, for instance, has enough recommendations to fill the design. If the key does not have enough\n    recommendations, second to last purchased item by visitor is considered and so forth until the design is\n    filled.\n\nIf the key is `CURRENT`, only `NONE` is valid.\n"
        },
        "backupDisabled": {
          "type": "boolean",
          "default": false,
          "description": "Whether backup recommendations are disabled when criteria does not generate enough recommendations."
        },
        "backupInclusionFilteringEnabled": {
          "type": "boolean",
          "default": true,
          "description": "Whether inclusion rules on the criteria should be applied to backup recommendations."
        },
        "configuration": {
          "$ref": "#/$defs/CriteriaItemConfiguration"
        },
        "criteriaGroup": {
          "type": "string",
          "enum": [
            "ITEM"
          ],
          "readOnly": true
        },
        "daysCount": {
          "type": "string",
          "enum": [
            "ONE_DAY",
            "TWO_DAYS",
            "ONE_WEEK",
            "TWO_WEEKS",
            "ONE_MONTH",
            "TWO_MONTHS"
          ],
          "description": "Time range of historical visitor behavioral data to consider for generating recommendations."
        },
        "enableCaching": {
          "type": "boolean",
          "default": false,
          "deprecated": true,
          "readOnly": true
        },
        "excludePurchases": {
          "type": "boolean",
          "default": false,
          "description": "Whether items that were previously purchased by the visitor should be excluded from recommendations."
        },
        "key": {
          "type": "string",
          "enum": [
            "CURRENT",
            "LAST_VIEWED",
            "LAST_PURCHASED",
            "MOST_VIEWED"
          ],
          "description": "Recommendation key. Values:\n\n- `CURRENT`: The currently viewed item.\n- `LAST_VIEWED`: The last viewed item.\n- `LAST_PURCHASED`: The last purchased item.\n- `MOST_VIEWED`: The most viewed item. The recommendations are determined by items that have been most viewed.\n  The score is determined by recency/frequency: 10 points for first item view, 5 points for every subsequent view,\n  all points are halved after the session ends.\n"
        },
        "minInventory": {
          "type": "integer",
          "format": "int32",
          "minimum": 0,
          "description": "Minimum number of pieces needed in stock for an item to be considered for recommendaton."
        },
        "partialDesignAllowed": {
          "type": "boolean",
          "default": false,
          "description": "Whether design be shown when the number of recommendations are less than item slots in the design."
        },
        "type": {
          "type": "string",
          "enum": [
            "VIEWED_BOUGHT",
            "BOUGHT_CF",
            "VIEWED_CF",
            "SITE_AFFINITY",
            "SIMILARITY"
          ],
          "description": "Recommendation logic. Values:\n\n  - `VIEWED_BOUGHT`: People who viewed this, bought that.\n  - `BOUGHT_CF`: People who bought this, bought that.\n  - `VIEWED_CF`: People who viewed this, viewed that.\n  - `SITE_AFFINITY`: Considers items based on the certainty of a relationship between items. Confidence setting is\n    used to determine how much data (strong or weak affinity) is required before a recommendation is presented.\n  - `SIMILARITY`: Considers items similar to items based on current page activity or past visitor behavior.\n"
        }
      },
      "required": [
        "configuration",
        "daysCount",
        "key",
        "type"
      ]
    }
  ],
  "$defs": {
    "AlgorithmRankingRule": {
      "type": "object",
      "properties": {
        "matcher": {
          "$ref": "#/$defs/Matcher"
        },
        "weighting": {
          "type": "integer",
          "format": "int32",
          "minimum": 0,
          "maximum": 4
        }
      }
    },
    "CriteriaConfiguration": {
      "type": "object",
      "properties": {
        "inclusionRules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/InclusionMatcher"
          },
          "maxItems": 1000,
          "description": "Filtering rules to narrow the items to be displayed as recommendations. Inclusion rules are conjunctive and all rules\nmust be met to include an item in a recommendation. [More info](https://marketing.adobe.com/resources/help/en_US/target/recs/t_create_new_algorithm.html).\n"
        },
        "priceRange": {
          "$ref": "#/$defs/CriteriaPriceRange"
        },
        "rankingRules": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AlgorithmRankingRule"
          },
          "maxItems": 1000,
          "description": "Rules for attribute weighting. Attribute weighting can be used to \"nudge\" the algorithm so certain items are more\nlikely to be shown. [More info](https://marketing.adobe.com/resources/help/en_US/target/recs/t_create_new_algorithm.html).\n"
        }
      },
      "description": "Object containing inclusion rules, attribute weighting, price filter, and some more configuration options specific to the criteria group."
    },
    "CriteriaItemConfiguration": {
      "allOf": [
        {
          "$ref": "#/$defs/CriteriaConfiguration"
        },
        {
          "type": "object",
          "properties": {
            "confidence": {
              "type": "string",
              "enum": [
                "VERY_WEAK",
                "WEAK",
                "MODERATE",
                "STRONG",
                "VERY_STRONG"
              ],
              "description": "Applicable only when type is `SITE_AFFINITY`. This determines how much data (strong or weak affinity) is required before a recommendation is presented."
            },
            "datasource": {
              "type": "string",
              "default": "mboxes",
              "description": "Behavioral data source can either be `mboxes` or a valid Analytics report report suite. A report suite can not be used when type is `SIMILARITY`."
            },
            "minSimilarity": {
              "type": "number",
              "format": "double",
              "minimum": 0.1,
              "maximum": 0.98,
              "default": 0.4,
              "description": "Applicable only when type is `SIMILARITY`. This is the threshold of minimum similarity required for two entities to be deemed similar. Lower number implies products will be more similar. But lower the number, criteria execution is exponentially longer."
            },
            "pastBehaviorOrdinal": {
              "type": "integer",
              "format": "int32"
            }
          }
        }
      ]
    },
    "CriteriaMin": {
      "type": "object",
      "properties": {
        "criteriaGroup": {
          "type": "string",
          "readOnly": true
        },
        "criteriaTitle": {
          "type": "string",
          "maxLength": 250,
          "description": "Displayed in the design using variable `$criteria.title`."
        },
        "id": {
          "type": "integer",
          "format": "int64",
          "readOnly": true
        },
        "name": {
          "type": "string",
          "maxLength": 250,
          "description": "Unique name of the criteria."
        },
        "description": {
          "type": "string",
          "maxLength": 1000
        },
        "lastModifiersName": {
          "type": "string",
          "readOnly": true
        },
        "lastModifiersEmail": {
          "type": "string",
          "readOnly": true
        },
        "lastModified": {
          "type": "string",
          "readOnly": true,
          "format": "date-time",
          "description": "The time in UTC when the criteria was last modified."
        }
      },
      "required": [
        "name"
      ]
    },
    "CriteriaPriceRange": {
      "type": "object",
      "properties": {
        "max": {
          "type": "number",
          "format": "double"
        },
        "min": {
          "type": "number",
          "format": "double"
        }
      },
      "description": "Price rule filter for items to be considered in recommendations."
    },
    "InclusionMatcher": {
      "type": "object",
      "properties": {
        "attribute": {
          "type": "string",
          "maxLength": 100
        },
        "highRange": {
          "type": "string"
        },
        "lowRange": {
          "type": "string"
        },
        "operation": {
          "type": "string"
        },
        "source": {
          "$ref": "#/$defs/SourceAttribute"
        },
        "values": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 250
          },
          "minItems": 1,
          "maxItems": 1000
        }
      },
      "required": [
        "attribute",
        "operation"
      ]
    },
    "Matcher": {
      "type": "object",
      "properties": {
        "attribute": {
          "type": "string",
          "maxLength": 100
        },
        "operation": {
          "type": "string"
        },
        "source": {
          "$ref": "#/$defs/SourceAttribute"
        },
        "values": {
          "type": "array",
          "items": {
            "type": "string",
            "maxLength": 250
          },
          "minItems": 1,
          "maxItems": 1000
        }
      },
      "required": [
        "attribute",
        "operation"
      ]
    },
    "SourceAttribute": {
      "type": "object",
      "properties": {
        "defaultValue": {
          "type": "string"
        },
        "excludeAllWhenEmpty": {
          "type": "boolean"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "type"
      ]
    }
  }
}