{
  "openapi": "3.1.0",
  "info": {
    "title": "Mux Image API",
    "description": "API for retrieving thumbnails, animated images, and storyboards from videos hosted using Mux.",
    "version": "v1",
    "contact": {
      "name": "Mux DevEx",
      "url": "https://docs.mux.com",
      "email": "devex@mux.com"
    }
  },
  "servers": [
    {
      "url": "https://image.mux.com"
    }
  ],
  "tags": [
    {
      "name": "Thumbnails",
      "description": "APIs for retrieving still thumbnails from videos hosted using Mux."
    },
    {
      "name": "Animated Images",
      "description": "APIs for retrieving animated images from videos hosted using Mux."
    },
    {
      "name": "Storyboards",
      "description": "APIs for retrieving storyboards, sprites, and metadata about the storyboards from videos hosted using Mux."
    }
  ],
  "x-tagGroups": [
    {
      "name": "Playback",
      "tags": [
        "Thumbnails",
        "Animated Images",
        "Storyboards"
      ]
    }
  ],
  "paths": {
    "/{PLAYBACK_ID}/thumbnail.{EXTENSION}": {
      "get": {
        "summary": "Retrieve a video thumbnail",
        "description": "[Fetch a thumbnail image from a video](https://docs.mux.com/guides/get-images-from-a-video) at a specified time with optional transformations.",
        "operationId": "get-thumbnail",
        "servers": [
          {
            "url": "https://image.mux.com"
          }
        ],
        "tags": [
          "Thumbnails"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/playback_id"
          },
          {
            "$ref": "#/components/parameters/token"
          },
          {
            "name": "EXTENSION",
            "in": "path",
            "required": true,
            "description": "The image file extension, either 'jpg', 'png', or 'webp'.",
            "schema": {
              "type": "string",
              "enum": [
                "jpg",
                "png",
                "webp"
              ]
            }
          },
          {
            "name": "time",
            "in": "query",
            "description": "The time (in seconds) of the video timeline where the image should be pulled. Defaults to the middle of the original video.",
            "schema": {
              "type": "number",
              "format": "float"
            }
          },
          {
            "name": "width",
            "in": "query",
            "description": "The width of the thumbnail (in pixels). Defaults to the width of the original video.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "height",
            "in": "query",
            "description": "The height of the thumbnail (in pixels). Defaults to the height of the original video.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "rotate",
            "in": "query",
            "description": "Rotate the image clockwise by the given number of degrees.",
            "schema": {
              "type": "integer",
              "enum": [
                90,
                180,
                270
              ]
            }
          },
          {
            "name": "fit_mode",
            "in": "query",
            "description": "How to fit a thumbnail within the specified width + height.",
            "schema": {
              "type": "string",
              "enum": [
                "preserve",
                "stretch",
                "crop",
                "smartcrop",
                "pad"
              ]
            }
          },
          {
            "name": "flip_v",
            "in": "query",
            "description": "Flip the image top-bottom after performing all other transformations.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "flip_h",
            "in": "query",
            "description": "Flip the image left-right after performing all other transformations.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "program_time",
            "in": "query",
            "description": "Set the time of the thumbnail for an 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"
            }
          },
          {
            "name": "latest",
            "in": "query",
            "description": "When set to `true`, pulls the latest thumbnail from the playback ID of an ongoing live stream. Can only be used with live streams. Can be used to build moderation and classification workflows, [see documentation for more details](https://mux.com/docs/guides/get-images-from-a-video#getting-the-latest-thumbnail-from-a-live-stream).",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Thumbnail image retrieved successfully.",
            "content": {
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Bad request due to invalid parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybackErrorResponse"
                },
                "example": {
                  "code": 3,
                  "message": "Unrecognized fit-mode"
                }
              }
            }
          },
          "404": {
            "description": "Video asset not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybackErrorResponse"
                },
                "example": {
                  "code": 5,
                  "message": "Not Found"
                }
              }
            }
          }
        }
      }
    },
    "/{PLAYBACK_ID}/animated.{EXTENSION}": {
      "get": {
        "summary": "Retrieve an animated image from a video",
        "description": "[Fetch an animated GIF or WebP image](https://docs.mux.com/guides/get-images-from-a-video#get-an-animated-gif-from-a-video) from a video segment with optional transformations.",
        "operationId": "get-animated",
        "servers": [
          {
            "url": "https://image.mux.com"
          }
        ],
        "tags": [
          "Animated Images"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/playback_id"
          },
          {
            "$ref": "#/components/parameters/token"
          },
          {
            "name": "EXTENSION",
            "in": "path",
            "required": true,
            "description": "The image file extension, either 'gif' or 'webp'.",
            "schema": {
              "type": "string",
              "enum": [
                "gif",
                "webp"
              ]
            }
          },
          {
            "name": "start",
            "in": "query",
            "description": "The time (in seconds) of the video timeline where the animated GIF should begin. Defaults to 0.",
            "schema": {
              "type": "number",
              "format": "float"
            }
          },
          {
            "name": "end",
            "in": "query",
            "description": "The time (in seconds) of the video timeline where the GIF ends. Defaults to 5 seconds after the start. Maximum total duration of GIF is limited to 10 seconds; minimum total duration of GIF is 250ms.",
            "schema": {
              "type": "number",
              "format": "float"
            }
          },
          {
            "name": "width",
            "in": "query",
            "description": "The width in pixels of the animated GIF. Default is 320px, or if height is provided, the width is determined by preserving aspect ratio with the height. Max width is 640px.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "height",
            "in": "query",
            "description": "The height in pixels of the animated GIF. The default height is determined by preserving aspect ratio with the width provided. Maximum height is 640px.",
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "fps",
            "in": "query",
            "description": "The frame rate of the generated GIF. Defaults to 15 fps. Max 30 fps.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Animated image retrieved successfully.",
            "content": {
              "image/gif": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "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}/storyboard.{EXTENSION}": {
      "get": {
        "summary": "Retrieve a storyboard image for timeline hover previews",
        "description": "Fetch a storyboard image composed of multiple thumbnails for use in [timeline hover previews](https://docs.mux.com/guides/create-timeline-hover-previews).",
        "operationId": "get-image-storyboard",
        "servers": [
          {
            "url": "https://image.mux.com"
          }
        ],
        "tags": [
          "Storyboards"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/playback_id"
          },
          {
            "$ref": "#/components/parameters/token"
          },
          {
            "name": "EXTENSION",
            "in": "path",
            "required": true,
            "description": "The storyboard image extension, either 'jpg', 'png', or 'webp'.",
            "schema": {
              "type": "string",
              "enum": [
                "jpg",
                "png",
                "webp"
              ]
            }
          },
          {
            "$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"
          }
        ],
        "responses": {
          "200": {
            "description": "Storyboard image retrieved successfully.",
            "content": {
              "image/jpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "image/webp": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "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}/storyboard.vtt": {
      "get": {
        "summary": "Retrieve storyboard metadata in WebVTT format",
        "description": "Fetch metadata for the [storyboard image in WebVTT format](https://docs.mux.com/guides/create-timeline-hover-previews#webvtt), detailing the coordinates and time ranges of each thumbnail.",
        "operationId": "get-vtt-storyboard",
        "servers": [
          {
            "url": "https://image.mux.com"
          }
        ],
        "tags": [
          "Storyboards"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/playback_id"
          },
          {
            "$ref": "#/components/parameters/token"
          },
          {
            "$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"
          }
        ],
        "responses": {
          "200": {
            "description": "WebVTT metadata retrieved successfully.",
            "content": {
              "text/vtt": {
                "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}/storyboard.json": {
      "get": {
        "summary": "Retrieve storyboard metadata in JSON format",
        "description": "Fetch metadata for the [storyboard image in JSON format](https://docs.mux.com/guides/create-timeline-hover-previews#json), detailing the coordinates and time ranges of each thumbnail.",
        "operationId": "get-json-storyboard",
        "servers": [
          {
            "url": "https://image.mux.com"
          }
        ],
        "tags": [
          "Storyboards"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/playback_id"
          },
          {
            "$ref": "#/components/parameters/token"
          },
          {
            "$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": "format",
            "in": "query",
            "description": "The format of the storyboard image URL in the response. Can be either 'jpg', 'png', or 'webp'. Defaults to 'jpg'.",
            "schema": {
              "type": "string",
              "enum": [
                "jpg",
                "png",
                "webp"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JSON storyboard retrieved successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoryboardMetadata"
                },
                "example": {
                  "url": "https://image.mux.com/RZG9sX4oLPxLHbdbx01Qwv00SVsiXB3Ku7/storyboard.jpg",
                  "tile_width": 284,
                  "tile_height": 160,
                  "duration": 93.794,
                  "tiles": [
                    {
                      "start": 0,
                      "x": 0,
                      "y": 0
                    },
                    {
                      "start": 1.874,
                      "x": 284,
                      "y": 0
                    },
                    {
                      "start": 3.748,
                      "x": 568,
                      "y": 0
                    }
                  ]
                }
              }
            }
          },
          "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"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "StoryboardMetadata": {
        "type": "object",
        "description": "Metadata describing a [storyboard image](https://docs.mux.com/guides/create-timeline-hover-previews#json), including where each thumbnail tile sits within it and the time it represents.",
        "required": [
          "url",
          "tile_width",
          "tile_height",
          "duration",
          "tiles"
        ],
        "properties": {
          "url": {
            "type": "string",
            "description": "The URL of the storyboard image, in the format requested with the `format` query parameter."
          },
          "tile_width": {
            "type": "integer",
            "description": "The width of each tile in pixels."
          },
          "tile_height": {
            "type": "integer",
            "description": "The height of each tile in pixels."
          },
          "duration": {
            "type": "number",
            "description": "The duration of the asset in seconds."
          },
          "tiles": {
            "type": "array",
            "description": "The tiles that make up the storyboard, ordered by start time.",
            "items": {
              "$ref": "#/components/schemas/StoryboardTile"
            }
          }
        }
      },
      "StoryboardTile": {
        "type": "object",
        "required": [
          "start",
          "x",
          "y"
        ],
        "properties": {
          "start": {
            "type": "number",
            "description": "The time in seconds within the asset that this tile represents."
          },
          "x": {
            "type": "integer",
            "description": "The horizontal offset of the tile within the storyboard image, in pixels."
          },
          "y": {
            "type": "integer",
            "description": "The vertical offset of the tile within the storyboard image, in pixels."
          }
        }
      },
      "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"
        }
      }
    }
  }
}