{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-cloudtrail/json-schema/amazon-cloudtrail-put-insight-selectors-request-schema.json",
  "title": "PutInsightSelectorsRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-cloudtrail-operations-api-openapi.yml#/components/schemas/PutInsightSelectorsRequest",
  "type": "object",
  "properties": {
    "TrailName": {
      "type": "string",
      "description": "The name of the CloudTrail trail for which you want to change or add Insights selectors. You cannot use this parameter with the EventDataStore and InsightsDestination parameters."
    },
    "InsightSelectors": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/InsightSelector"
      },
      "description": "Contains the Insights types you want to log on a specific category of events on a trail or event data store. ApiCallRateInsight and ApiErrorRateInsight are valid Insight types.The EventCategory field can specify Management or Data events or both. For event data store, you can log Insights for management events only. The ApiCallRateInsight Insights type analyzes write-only management API calls or read and write data API calls that are aggregated per minute against a baseline API call volume. The ApiErrorRateInsight Insights type analyzes management and data API calls that result in error codes."
    },
    "EventDataStore": {
      "type": "string",
      "description": "The ARN (or ID suffix of the ARN) of the source event data store for which you want to change or add Insights selectors. To enable Insights on an event data store, you must provide both the EventDataStore and InsightsDestination parameters. You cannot use this parameter with the TrailName parameter."
    },
    "InsightsDestination": {
      "type": "string",
      "description": "The ARN (or ID suffix of the ARN) of the destination event data store that logs Insights events. To enable Insights on an event data store, you must provide both the EventDataStore and InsightsDestination parameters. You cannot use this parameter with the TrailName parameter."
    }
  },
  "required": [
    "InsightSelectors"
  ],
  "$defs": {
    "InsightSelector": {
      "type": "object",
      "properties": {
        "InsightType": {
          "type": "string",
          "enum": [
            "ApiCallRateInsight",
            "ApiErrorRateInsight"
          ],
          "description": "The type of Insights events to log on a trail or event data store. ApiCallRateInsight and ApiErrorRateInsight are valid Insight types. The ApiCallRateInsight Insights type analyzes write-only management API calls or read and write data API calls that are aggregated per minute against a baseline API call volume. The ApiErrorRateInsight Insights type analyzes management and data API calls that result in error codes. The error is shown if the API call is unsuccessful."
        },
        "EventCategories": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "Management",
              "Data"
            ]
          },
          "description": "Select the event category on which Insights should be enabled. If EventCategories is not provided, the specified Insights types are enabled on management API calls by default. If EventCategories is provided, the given event categories will overwrite the existing ones. For example, if a trail already has Insights enabled on management events, and then a PutInsightSelectors request is made with only data events specified in EventCategories, Insights on management events will be disabled."
        }
      }
    }
  }
}