{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-personalize/json-schema/amazon-personalize-create-metric-attribution-request-schema.json",
  "title": "CreateMetricAttributionRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-personalize-metric-attribution-api-openapi.yml#/components/schemas/CreateMetricAttributionRequest",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "A name for the metric attribution."
    },
    "datasetGroupArn": {
      "type": "string",
      "description": "The Amazon Resource Name (ARN) of the destination dataset group for the metric attribution."
    },
    "metrics": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/MetricAttribute"
      },
      "description": "A list of metric attributes for the metric attribution. Each metric attribute specifies an event type to track and a function. Available functions are SUM() or SAMPLECOUNT(). For SUM() functions, provide the dataset type (either Interactions or Items) and column to sum as a parameter. For example SUM(Items.PRICE)."
    },
    "metricsOutputConfig": {
      "$ref": "#/$defs/MetricAttributionOutput"
    }
  },
  "required": [
    "name",
    "datasetGroupArn",
    "metrics",
    "metricsOutputConfig"
  ],
  "$defs": {
    "MetricAttribute": {
      "type": "object",
      "properties": {
        "eventType": {
          "type": "string",
          "description": "The metric's event type."
        },
        "metricName": {
          "type": "string",
          "description": "The metric's name. The name helps you identify the metric in Amazon CloudWatch or Amazon S3."
        },
        "expression": {
          "type": "string",
          "description": "The attribute's expression. Available functions are SUM() or SAMPLECOUNT(). For SUM() functions, provide the dataset type (either Interactions or Items) and column to sum as a parameter. For example SUM(Items.PRICE)."
        }
      },
      "required": [
        "eventType",
        "metricName",
        "expression"
      ]
    },
    "MetricAttributionOutput": {
      "type": "object",
      "properties": {
        "s3DataDestination": {
          "$ref": "#/$defs/S3DataConfig"
        },
        "roleArn": {
          "type": "string",
          "description": "The Amazon Resource Name (ARN) of the IAM service role that has permissions to add data to your output Amazon S3 bucket and add metrics to Amazon CloudWatch. For more information, see Measuring impact of recommendations."
        }
      },
      "required": [
        "roleArn"
      ]
    },
    "S3DataConfig": {
      "type": "object",
      "properties": {
        "path": {
          "type": "string",
          "description": "The file path of the Amazon S3 bucket."
        },
        "kmsKeyArn": {
          "type": "string",
          "description": "The Amazon Resource Name (ARN) of the Key Management Service (KMS) key that Amazon Personalize uses to encrypt or decrypt the input and output files."
        }
      },
      "required": [
        "path"
      ]
    }
  }
}