{
  "openapi": "3.1.0",
  "info": {
    "title": "Mux Streaming API",
    "description": "API for streaming video content via HLS and MP4 with customizable playback options.",
    "version": "v1",
    "contact": {
      "name": "Mux DevEx",
      "url": "https://docs.mux.com",
      "email": "devex@mux.com"
    }
  },
  "servers": [
    {
      "url": "https://stream.mux.com"
    }
  ],
  "tags": [
    {
      "name": "Streaming",
      "description": "APIs for streaming video content via HLS and MP4 with customizable playback options."
    },
    {
      "name": "Captions and Transcripts",
      "description": "APIs for retrieving captions and transcripts from videos hosted using Mux that have had captions generated automatically."
    },
    {
      "name": "Chapters",
      "description": "APIs for retrieving chapters from videos hosted using Mux that have a chapters text track."
    }
  ],
  "x-tagGroups": [
    {
      "name": "Playback",
      "tags": [
        "Streaming",
        "Captions and Transcripts",
        "Chapters"
      ]
    }
  ],
  "paths": {
    "/{PLAYBACK_ID}.m3u8": {
      "get": {
        "summary": "Retrieve HLS manifest",
        "description": "Fetch an HLS (HTTP Live Streaming) playlist for the specified video asset, with optional query parameters to [modify playback behavior](https://docs.mux.com/guides/modify-playback-behavior).",
        "operationId": "get-hls-manifest",
        "servers": [
          {
            "url": "https://stream.mux.com"
          }
        ],
        "tags": [
          "Streaming"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/playback_id"
          },
          {
            "$ref": "#/components/parameters/token"
          },
          {
            "name": "redundant_streams",
            "in": "query",
            "description": "Include [HLS redundant streams](https://docs.mux.com/guides/play-your-videos#add-delivery-redundancy-with-redundant-streams) in the manifest.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "roku_trick_play",
            "in": "query",
            "description": "Add support for [timeline hover previews on Roku devices](https://docs.mux.com/guides/create-timeline-hover-previews#roku-trick-play).",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "default_subtitles_lang",
            "in": "query",
            "description": "Set the [default subtitles/captions language](https://docs.mux.com/guides/add-subtitles-to-your-videos#showing-subtitles-by-default) (BCP47 compliant language code).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "max_resolution",
            "in": "query",
            "description": "Set the [maximum resolution](https://docs.mux.com/guides/control-playback-resolution#specify-maximum-resolution) of renditions included in the manifest.",
            "schema": {
              "type": "string",
              "enum": [
                "270p",
                "360p",
                "480p",
                "540p",
                "720p",
                "1080p",
                "1440p",
                "2160p"
              ]
            }
          },
          {
            "name": "min_resolution",
            "in": "query",
            "description": "Set the [minimum resolution](https://docs.mux.com/guides/control-playback-resolution#specify-minimum-resolution) of renditions included in the manifest.",
            "schema": {
              "type": "string",
              "enum": [
                "270p",
                "360p",
                "480p",
                "540p",
                "720p",
                "1080p",
                "1440p",
                "2160p"
              ]
            }
          },
          {
            "name": "rendition_order",
            "in": "query",
            "description": "Set the logic to [order renditions in the HLS manifest](https://www.mux.com/blog/more-tools-to-control-playback-behavior-min-resolution-and-rendition-order#rendition_order).",
            "schema": {
              "type": "string",
              "enum": [
                "desc"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/instant_clip_program_start_time"
          },
          {
            "$ref": "#/components/parameters/instant_clip_program_end_time"
          },
          {
            "$ref": "#/components/parameters/instant_clip_asset_start_time"
          },
          {
            "$ref": "#/components/parameters/instant_clip_asset_end_time"
          },
          {
            "name": "exclude_pdt",
            "in": "query",
            "description": "If set to true, EXT-X-PROGRAM-DATE-TIME tags will be omitted from HLS manifests for assets from live streams.",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "HLS playlist retrieved successfully.",
            "content": {
              "application/vnd.apple.mpegurl": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Bad request due to invalid parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybackErrorResponse"
                },
                "example": {
                  "code": 3,
                  "message": "Invalid parameter"
                }
              }
            }
          },
          "404": {
            "description": "Video asset not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybackErrorResponse"
                },
                "example": {
                  "code": 5,
                  "message": "Not Found"
                }
              }
            }
          }
        }
      }
    },
    "/{PLAYBACK_ID}/{FILENAME}": {
      "get": {
        "summary": "Retrieve a static rendition",
        "description": "Fetch a static rendition (usually an MP4 or M4A file) of the specified video asset. [MP4 Support](https://docs.mux.com/guides/enable-static-mp4-renditions) must be enabled on the asset before using these URLs.",
        "operationId": "get-static-rendition",
        "servers": [
          {
            "url": "https://stream.mux.com"
          }
        ],
        "tags": [
          "Streaming"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/playback_id"
          },
          {
            "$ref": "#/components/parameters/token"
          },
          {
            "name": "FILENAME",
            "in": "path",
            "required": true,
            "description": "The filename of the static rendition file, as returned from the static renditions API files list. [See the MP4 guide for more details.](https://docs.mux.com/guides/enable-static-mp4-renditions)",
            "schema": {
              "type": "string",
              "enum": [
                "capped-1080p.mp4",
                "audio.m4a",
                "low.mp4",
                "medium.mp4",
                "high.mp4"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "MP4 file retrieved successfully.",
            "content": {
              "video/mp4": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "audio/m4a": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request due to missing or incorrect parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybackErrorResponse"
                },
                "example": {
                  "code": 3,
                  "message": "Invalid parameter"
                }
              }
            }
          },
          "404": {
            "description": "The requested video asset or rendition was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybackErrorResponse"
                },
                "example": {
                  "code": 5,
                  "message": "Not Found"
                }
              }
            }
          }
        }
      }
    },
    "/{PLAYBACK_ID}/text/{TRACK_ID}.vtt": {
      "get": {
        "summary": "Retrieve a WebVTT file for a text track",
        "description": "Fetch a standalone WebVTT version of a text track from an asset.",
        "operationId": "get-vtt-text-track",
        "servers": [
          {
            "url": "https://stream.mux.com"
          }
        ],
        "tags": [
          "Captions and Transcripts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/playback_id"
          },
          {
            "$ref": "#/components/parameters/track_id"
          },
          {
            "$ref": "#/components/parameters/token"
          }
        ],
        "responses": {
          "200": {
            "description": "WebVTT retrieved successfully.",
            "content": {
              "text/vtt": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request due to missing or incorrect parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybackErrorResponse"
                },
                "example": {
                  "code": 3,
                  "message": "Invalid parameter"
                }
              }
            }
          },
          "404": {
            "description": "The requested text track was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybackErrorResponse"
                },
                "example": {
                  "code": 5,
                  "message": "Not Found"
                }
              }
            }
          }
        }
      }
    },
    "/{PLAYBACK_ID}/text/{TRACK_ID}.txt": {
      "get": {
        "summary": "Retrieve a transcript",
        "description": "Fetch a [transcript of an asset](https://docs.mux.com/guides/add-autogenerated-captions-and-use-transcripts#retrieve-a-transcript). This is only possible for assets with a text track generated using the [VOD generated captions feature](https://docs.mux.com/guides/add-autogenerated-captions-and-use-transcripts).",
        "operationId": "get-transcript",
        "servers": [
          {
            "url": "https://stream.mux.com"
          }
        ],
        "tags": [
          "Captions and Transcripts"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/playback_id"
          },
          {
            "$ref": "#/components/parameters/track_id"
          },
          {
            "$ref": "#/components/parameters/token"
          }
        ],
        "responses": {
          "200": {
            "description": "Transcript retrieved successfully.",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request due to missing or incorrect parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybackErrorResponse"
                },
                "example": {
                  "code": 3,
                  "message": "Invalid parameter"
                }
              }
            }
          },
          "404": {
            "description": "The requested text track was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybackErrorResponse"
                },
                "example": {
                  "code": 5,
                  "message": "Not Found"
                }
              }
            }
          }
        }
      }
    },
    "/{PLAYBACK_ID}/chapters/{TRACK_ID}.json": {
      "get": {
        "summary": "Retrieve chapters",
        "description": "Fetch the chapters for an asset as JSON. This is only possible for assets with a text track where `text_type` is `chapters`.",
        "operationId": "get-chapters",
        "servers": [
          {
            "url": "https://stream.mux.com"
          }
        ],
        "tags": [
          "Chapters"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/playback_id"
          },
          {
            "$ref": "#/components/parameters/track_id"
          },
          {
            "$ref": "#/components/parameters/token"
          }
        ],
        "responses": {
          "200": {
            "description": "Chapters retrieved successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "description": "The chapters of the asset in [HLS JSON chapters format](https://developer.apple.com/documentation/http-live-streaming/providing-javascript-object-notation-json-chapters).",
                  "items": {
                    "$ref": "#/components/schemas/HLSChapter"
                  }
                },
                "example": [
                  {
                    "chapter": 1,
                    "start-time": 0,
                    "titles": [
                      {
                        "language": "en",
                        "title": "Introduction"
                      }
                    ]
                  },
                  {
                    "chapter": 2,
                    "start-time": 120,
                    "titles": [
                      {
                        "language": "en",
                        "title": "Main Content"
                      }
                    ]
                  }
                ]
              }
            }
          },
          "400": {
            "description": "Invalid request due to missing or incorrect parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybackErrorResponse"
                },
                "example": {
                  "code": 3,
                  "message": "Invalid parameter"
                }
              }
            }
          },
          "404": {
            "description": "The requested chapters track was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybackErrorResponse"
                },
                "example": {
                  "code": 5,
                  "message": "Not Found"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "HLSChapter": {
        "type": "object",
        "description": "A chapter entry in the [HLS JSON chapters format](https://developer.apple.com/documentation/http-live-streaming/providing-javascript-object-notation-json-chapters). A chapter runs from its `start-time` to the `start-time` of the next chapter unless `duration` is set.",
        "required": [
          "start-time"
        ],
        "properties": {
          "chapter": {
            "type": "number",
            "minimum": 1,
            "description": "The chapter number."
          },
          "start-time": {
            "type": "number",
            "minimum": 0,
            "description": "The chapter start time in seconds."
          },
          "duration": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "The chapter duration in seconds. Only present when chapters overlap or nest."
          },
          "titles": {
            "type": "array",
            "description": "The chapter title in each available language.",
            "items": {
              "$ref": "#/components/schemas/HLSChapterTitle"
            }
          },
          "images": {
            "type": "array",
            "description": "Images associated with the chapter.",
            "items": {
              "$ref": "#/components/schemas/HLSChapterImage"
            }
          },
          "metadata": {
            "type": "array",
            "description": "Arbitrary metadata associated with the chapter.",
            "items": {
              "$ref": "#/components/schemas/HLSChapterMetadata"
            }
          }
        }
      },
      "HLSChapterTitle": {
        "type": "object",
        "required": [
          "language",
          "title"
        ],
        "properties": {
          "language": {
            "type": "string",
            "description": "The [BCP 47](https://tools.ietf.org/html/bcp47) language code of the title, or `und` if the title is language-neutral."
          },
          "title": {
            "type": "string",
            "description": "The chapter title in the given language."
          }
        }
      },
      "HLSChapterImage": {
        "type": "object",
        "required": [
          "image-category",
          "pixel-width",
          "pixel-height",
          "url"
        ],
        "properties": {
          "image-category": {
            "type": "string",
            "description": "A category identifying similar images across chapters, for example `thumbnail`."
          },
          "pixel-width": {
            "type": "number",
            "description": "The width of the image in pixels."
          },
          "pixel-height": {
            "type": "number",
            "description": "The height of the image in pixels."
          },
          "url": {
            "type": "string",
            "description": "The absolute or relative URL of the image. Relative URLs are relative to the chapters document."
          }
        }
      },
      "HLSChapterMetadata": {
        "type": "object",
        "required": [
          "key",
          "value"
        ],
        "properties": {
          "key": {
            "type": "string",
            "description": "The metadata key."
          },
          "value": {
            "description": "The metadata value. Can be a string, number, boolean, array, or object.",
            "x-stainless-any": true,
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "array",
                "items": {}
              },
              {
                "type": "object",
                "additionalProperties": true
              }
            ]
          },
          "language": {
            "type": "string",
            "description": "The [BCP 47](https://tools.ietf.org/html/bcp47) language code of the value, if it is language-specific."
          }
        }
      },
      "PlaybackErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "message"
            ],
            "properties": {
              "message": {
                "type": "string",
                "description": "Description of the error"
              },
              "messages": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Description of the errors"
              },
              "type": {
                "type": "string",
                "description": "Category of the error"
              },
              "code": {
                "type": "integer",
                "format": "int32",
                "description": "Internal error code"
              }
            }
          },
          "code": {
            "type": "integer",
            "format": "int32",
            "description": "Internal error code"
          },
          "message": {
            "type": "string",
            "description": "Description of the error"
          }
        }
      }
    },
    "parameters": {
      "instant_clip_asset_end_time": {
        "name": "asset_end_time",
        "in": "query",
        "description": "Set the relative end time of the asset (in seconds) when using the [instant clipping feature](https://docs.mux.com/guides/create-instant-clips).",
        "schema": {
          "type": "number",
          "format": "float"
        }
      },
      "instant_clip_asset_start_time": {
        "name": "asset_start_time",
        "in": "query",
        "description": "Set the relative start time of the asset (in seconds) when using the [instant clipping feature](https://docs.mux.com/guides/create-instant-clips).",
        "schema": {
          "type": "number",
          "format": "float"
        }
      },
      "instant_clip_program_end_time": {
        "name": "program_end_time",
        "in": "query",
        "description": "Set the end time of the asset created from a live stream when using the [instant clipping feature](https://docs.mux.com/guides/create-instant-clips). The timestamp should be provided as an epoch integer, and is compared to the program date time (PDT) generated by a live stream.",
        "schema": {
          "type": "integer"
        }
      },
      "instant_clip_program_start_time": {
        "name": "program_start_time",
        "in": "query",
        "description": "Set the start time of the asset created from a live stream when using the [instant clipping feature](https://docs.mux.com/guides/create-instant-clips). The timestamp should be provided as an epoch integer, and is compared to the program date time (PDT) generated by a live stream.",
        "schema": {
          "type": "integer"
        }
      },
      "playback_id": {
        "name": "PLAYBACK_ID",
        "in": "path",
        "description": "The asset or live stream's playback ID.",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "token": {
        "name": "token",
        "in": "query",
        "description": "Signed token (JWT) for [secure video playback](https://docs.mux.com/guides/secure-video-playback).",
        "schema": {
          "type": "string"
        }
      },
      "track_id": {
        "name": "TRACK_ID",
        "in": "path",
        "description": "The ID of the track for an asset.",
        "required": true,
        "schema": {
          "type": "string"
        }
      }
    }
  }
}