{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-mediatailor/json-schema/amazon-mediatailor-create-prefetch-schedule-request-schema.json",
  "title": "CreatePrefetchScheduleRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-mediatailor-prefetch-schedule-api-openapi.yml#/components/schemas/CreatePrefetchScheduleRequest",
  "type": "object",
  "properties": {
    "Consumption": {
      "$ref": "#/$defs/PrefetchConsumption"
    },
    "Name": {
      "type": "string",
      "description": "The name to assign to the schedule request."
    },
    "PlaybackConfigurationName": {
      "type": "string",
      "description": "The name to assign to the playback configuration."
    },
    "Retrieval": {
      "$ref": "#/$defs/PrefetchRetrieval"
    },
    "RecurringPrefetchConfiguration": {
      "$ref": "#/$defs/RecurringPrefetchConfiguration"
    },
    "ScheduleType": {
      "type": "string",
      "enum": [
        "SINGLE",
        "RECURRING"
      ],
      "description": "The frequency that MediaTailor creates prefetch schedules. SINGLE indicates that this schedule applies to one ad break. RECURRING indicates that MediaTailor automatically creates a schedule for each ad avail in a live event. For more information about the prefetch types and when you might use each, see Prefetching ads in Elemental MediaTailor."
    },
    "StreamId": {
      "type": "string",
      "description": "An optional stream identifier that MediaTailor uses to prefetch ads for multiple streams that use the same playback configuration. If StreamId is specified, MediaTailor returns all of the prefetch schedules with an exact match on StreamId. If not specified, MediaTailor returns all of the prefetch schedules for the playback configuration, regardless of StreamId."
    },
    "Tags": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "The tags to assign to the prefetch schedule. Tags are key-value pairs that you can associate with Amazon resources to help with organization, access control, and cost tracking. For more information, see Tagging AWS Elemental MediaTailor Resources."
    }
  },
  "required": [
    "Name",
    "PlaybackConfigurationName"
  ],
  "$defs": {
    "AvailMatchingCriteria": {
      "type": "object",
      "properties": {
        "DynamicVariable": {
          "type": "string",
          "description": "The dynamic variable(s) that MediaTailor should use as avail matching criteria. MediaTailor only places the prefetched ads into the avail if the avail matches the criteria defined by the dynamic variable. For information about dynamic variables, see Using dynamic ad variables in the MediaTailor User Guide. You can include up to 100 dynamic variables."
        },
        "Operator": {
          "type": "string",
          "enum": [
            "EQUALS"
          ],
          "description": "For the DynamicVariable specified in AvailMatchingCriteria, the Operator that is used for the comparison."
        }
      },
      "required": [
        "DynamicVariable",
        "Operator"
      ]
    },
    "PrefetchConsumption": {
      "type": "object",
      "properties": {
        "AvailMatchingCriteria": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AvailMatchingCriteria"
          },
          "description": "If you only want MediaTailor to insert prefetched ads into avails (ad breaks) that match specific dynamic variables, such as scte.event_id, set the avail matching criteria."
        },
        "EndTime": {
          "type": "string",
          "format": "date-time",
          "description": "The time when MediaTailor no longer considers the prefetched ads for use in an ad break. MediaTailor automatically deletes prefetch schedules no less than seven days after the end time. If you'd like to manually delete the prefetch schedule, you can call DeletePrefetchSchedule."
        },
        "StartTime": {
          "type": "string",
          "format": "date-time",
          "description": "The time when prefetched ads are considered for use in an ad break. If you don't specify StartTime, the prefetched ads are available after MediaTailor retrieves them from the ad decision server."
        }
      },
      "required": [
        "EndTime"
      ]
    },
    "PrefetchRetrieval": {
      "type": "object",
      "properties": {
        "DynamicVariables": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "The dynamic variables to use for substitution during prefetch requests to the ad decision server (ADS). You initially configure dynamic variables for the ADS URL when you set up your playback configuration. When you specify DynamicVariables for prefetch retrieval, MediaTailor includes the dynamic variables in the request to the ADS."
        },
        "EndTime": {
          "type": "string",
          "format": "date-time",
          "description": "The time when prefetch retrieval ends for the ad break. Prefetching will be attempted for manifest requests that occur at or before this time."
        },
        "StartTime": {
          "type": "string",
          "format": "date-time",
          "description": "The time when prefetch retrievals can start for this break. Ad prefetching will be attempted for manifest requests that occur at or after this time. Defaults to the current time. If not specified, the prefetch retrieval starts as soon as possible."
        },
        "TrafficShapingType": {
          "type": "string",
          "enum": [
            "RETRIEVAL_WINDOW",
            "TPS"
          ],
          "description": "Indicates the type of traffic shaping used to limit the number of requests to the ADS at one time."
        },
        "TrafficShapingRetrievalWindow": {
          "$ref": "#/$defs/TrafficShapingRetrievalWindow"
        },
        "TrafficShapingTpsConfiguration": {
          "$ref": "#/$defs/TrafficShapingTpsConfiguration"
        }
      },
      "required": [
        "EndTime"
      ]
    },
    "RecurringConsumption": {
      "type": "object",
      "properties": {
        "RetrievedAdExpirationSeconds": {
          "type": "integer",
          "description": "The number of seconds that an ad is available for insertion after it was prefetched."
        },
        "AvailMatchingCriteria": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AvailMatchingCriteria"
          },
          "description": "The configuration for the dynamic variables that determine which ad breaks that MediaTailor inserts prefetched ads in."
        }
      }
    },
    "RecurringPrefetchConfiguration": {
      "type": "object",
      "properties": {
        "StartTime": {
          "type": "string",
          "format": "date-time",
          "description": "The start time for the window that MediaTailor prefetches and inserts ads in a live event."
        },
        "EndTime": {
          "type": "string",
          "format": "date-time",
          "description": "The end time for the window that MediaTailor prefetches and inserts ads in a live event."
        },
        "RecurringConsumption": {
          "$ref": "#/$defs/RecurringConsumption"
        },
        "RecurringRetrieval": {
          "$ref": "#/$defs/RecurringRetrieval"
        }
      },
      "required": [
        "EndTime",
        "RecurringConsumption",
        "RecurringRetrieval"
      ]
    },
    "RecurringRetrieval": {
      "type": "object",
      "properties": {
        "DynamicVariables": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "The dynamic variables to use for substitution during prefetch requests to the ADS."
        },
        "DelayAfterAvailEndSeconds": {
          "type": "integer",
          "description": "The number of seconds that MediaTailor waits after an ad avail before prefetching ads for the next avail. If not set, the default is 0 (no delay)."
        },
        "TrafficShapingType": {
          "type": "string",
          "enum": [
            "RETRIEVAL_WINDOW",
            "TPS"
          ],
          "description": "Indicates the type of traffic shaping used to limit the number of requests to the ADS at one time."
        },
        "TrafficShapingRetrievalWindow": {
          "$ref": "#/$defs/TrafficShapingRetrievalWindow"
        },
        "TrafficShapingTpsConfiguration": {
          "$ref": "#/$defs/TrafficShapingTpsConfiguration"
        }
      }
    },
    "TrafficShapingRetrievalWindow": {
      "type": "object",
      "properties": {
        "RetrievalWindowDurationSeconds": {
          "type": "integer",
          "description": "The amount of time, in seconds, that MediaTailor spreads prefetch requests to the ADS."
        }
      }
    },
    "TrafficShapingTpsConfiguration": {
      "type": "object",
      "properties": {
        "PeakTps": {
          "type": "integer",
          "description": "The maximum number of transactions per second (TPS) that your ad decision server (ADS) can handle. MediaTailor uses this value along with concurrent users and headroom multiplier to calculate optimal traffic distribution and prevent ADS overload."
        },
        "PeakConcurrentUsers": {
          "type": "integer",
          "description": "The expected peak number of concurrent viewers for your content. MediaTailor uses this value along with peak TPS to determine how to distribute prefetch requests across the available capacity without exceeding your ADS limits."
        }
      }
    }
  }
}