[Yandex Cloud documentation](../../../index.md) > [Yandex Cloud Video](../../index.md) > [Step-by-step guides](../index.md) > Broadcasts > Adding a thumbnail

# Adding a thumbnail for a broadcast

To add a thumbnail for a broadcast:

{% list tabs group=instructions %}

- Cloud Video UI {#console}

  1. Open the Cloud Video [home page](https://video.yandex.cloud/).
  1. Select a channel.
  1. In the ![image](../../../_assets/console-icons/antenna-signal.svg) **Broadcasts** tab, select the broadcast you need.
  1. Under **Episodes**, click ![image](../../../_assets/console-icons/ellipsis.svg) and select **Edit** in the episode line.
  1. If the episode already has a thumbnail, delete it. To do this, hover over the thumbnail preview and click ![image](../../../_assets/console-icons/circle-xmark.svg).
  1. Click ![image](../../../_assets/console-icons/cloud-arrow-up-in.svg) **Select file** and select a new thumbnail image.

      The following cover formats are supported: [JPG](https://en.wikipedia.org/wiki/JPEG), [PNG](https://en.wikipedia.org/wiki/PNG), and [GIF](https://en.wikipedia.org/wiki/GIF).

  1. Click **Save**.

- REST API {#api}

  1. Getting started:
  
      * [Get](../../../organization/operations/organization-get-id.md) the ID of the organization your Cloud Video [channel](../../concepts/index.md#channels) belongs to.
      * [Get](../../api-ref/authentication.md) an IAM token, which is required for authentication in the Cloud Video API.
      * To use the examples, install [cURL](https://curl.haxx.se).
  1. Get a list of Cloud Video channels in your organization:

      ```bash
      curl \
        --request GET \
        --url 'https://video.api.cloud.yandex.net/video/v1/channels?organizationId=<organization_ID>' \
        --header 'Authorization: Bearer <IAM_token>'
      ```
      
      Where:
      * `<organization_ID>`: Organization ID you got before you started.
      * `<IAM_token>`: IAM token you got before you started.
      
      Result:
      
      ```text
      {
       "channels": [
        {
         "id": "vplc3neipzso********",
         "organizationId": "bpfaidqca8vd********",
         "title": "my-first-channel",
         "description": "My very first Cloud Video channel",
         "createdAt": "2023-07-07T10:51:48.658737Z",
         "updatedAt": "2023-07-07T10:51:48.658737Z"
        },
        {
         "id": "vplc3vssjcxh********",
         "organizationId": "bpfaidqca8vd********",
         "title": "my-work-channel",
         "createdAt": "2023-08-09T23:32:55.372456Z",
         "updatedAt": "2023-08-09T23:32:55.372456Z"
        },
        {
         "id": "vplc4cfwamlx********",
         "organizationId": "bpfaidqca8vd********",
         "title": "my-personal-channel",
         "createdAt": "2024-03-14T13:48:34.535821Z",
         "updatedAt": "2024-03-14T13:48:34.535821Z"
        },
       ]
      }
      ```
      
      Save the `id` of the channel to whose storage you want to upload the thumbnail.

  1. Get a list of broadcasts on the channel:

      ```bash
      curl \
        --request GET \
        --url 'https://video.api.cloud.yandex.net/video/v1/streams?channelId=<channel_ID>' \
        --header 'Authorization: Bearer <IAM_token>'
      ```

      Where:
      * `<channel_ID>`: ID of the channel with the broadcast you want to add a thumbnail for.
      * `<IAM_token>`: IAM token you got before you started.

      Result:

      ```text
      {
       "streams": [
        {
         "onDemand": {},
         "id": "vplsfj23t7tf********",
         "channelId": "vplcdyphvqik********",
         "lineId": "vplldrpqy42y********",
         "title": "my-first-stream",
         "status": "OFFLINE",
         "createdAt": "2024-11-03T16:55:32.976950Z",
         "updatedAt": "2024-11-03T16:55:33.091744Z"
        },
        {
         "onDemand": {},
         "id": "vplsgchsr5gi********",
         "channelId": "vplcdyphvqik********",
         "lineId": "vpllxc2mfleb********",
         "title": "my-new-stream",
         "thumbnailId": "vpltznjxpnyj********",
         "status": "OFFLINE",
         "createdAt": "2024-11-03T16:34:10.617101Z",
         "updatedAt": "2024-11-03T16:35:06.601920Z"
        }
       ]
      }
      ```

      Save the `id` of the broadcast you want to add a thumbnail for.

  1. Get the list of broadcast episodes:

      ```bash
      curl \
        --request GET \
        --url 'https://video.api.cloud.yandex.net/video/v1/episodes?streamId=<broadcast_ID>' \
        --header 'Authorization: Bearer <IAM_token>'
      ```

      Where:
      * `<broadcast_ID>`: Previously saved broadcast ID.
      * `<IAM_token>`: IAM token you got before you started.

      Result:

      ```text
      {
       "episodes": [
        {
         "id": "vpleof6lm40k********",
         "streamId": "vplsfj23t7tf********",
         "lineId": "vplldrpqy42y********",
         "title": "my-first-episode",
         "visibilityStatus": "PUBLISHED",
         "createdAt": "2024-11-03T16:55:32.976950Z",
         "updatedAt": "2024-11-03T16:55:33.091744Z"
        }
       ]
      }
      ```

      Save the `id` of the episode you want to add a thumbnail for.

  1. Register your thumbnail in Cloud Video:

      ```bash
      curl \
        --request POST \
        --url 'https://video.api.cloud.yandex.net/video/v1/thumbnails' \
        --header 'Authorization: Bearer <IAM_token>' \
        --header 'Content-Type: application/json' \
        --data '{
          "episodeId": "<episode_ID>"
        }'
      ```

      Where:
      * `<IAM_token>`: IAM token you got before you started.
      * `episodeId`: Previously saved episode ID.

      Result:

      ```text
      {
       "done": true,
       "metadata": {
        "@type": "type.googleapis.com/yandex.cloud.video.v1.CreateThumbnailMetadata",
        "thumbnailId": "vpltaurfr4pr********"
       },
       "response": {
        "@type": "type.googleapis.com/yandex.cloud.video.v1.Thumbnail",
        "id": "vpltaurfr4pr********",
        "channelId": "vplcdyphvqik********",
        "episodeId": "vpleof6lm40k********",
        "createdAt": "2024-11-02T16:56:19.296797Z"
       },
       "id": "vplpgbyqopdr********",
       "description": "Thumbnail create",
       "createdAt": "2024-11-02T16:56:19.301776Z",
       "createdBy": "ajeol2afu1js********",
       "modifiedAt": "2024-11-02T16:56:19.301776Z"
      }
      ```

      Save the `thumbnailId` value: you will need it later.

  1. Get a thumbnail upload link:

      ```bash
      curl \
        --request POST \
        --url 'https://video.api.cloud.yandex.net/video/v1/thumbnails/<thumbnail_ID>:generateUploadURL' \
        --header 'Authorization: Bearer <IAM_token>'
      ```

      Where:
      * `<IAM_token>`: IAM token you got before you started.
      * `<thumbnail_ID>`: Previously saved thumbnail ID.
      
      Result:
      
      ```text
      {
        "uploadUrl": "https://storage.yandexcloud.net/videoplatform-thumbnail/vpltleyrfnjh********?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=********3aBOmv27nzbJZaEHZ%2F20241102%2Fru-central1%2Fs3%2Faws4_request&X-Amz-Date=20241102T190000Z&X-Amz-Expires=43200&X-Amz-Signature=057fe4c0da26c7758474f5eaa85ff41d7212632572fb636ed6d8f65d039c309b&X-Amz-SignedHeaders=host"
      }
      ```
      
      The `uploadUrl` field contains a signed link you can use to upload the thumbnail file.

  1. Upload an image file to the thumbnail:

      ```
      curl \
        --request PUT \
        --url '<signed_link>' \
        --header 'Content-Type: image/<image_format>' \
        --upload-file '<path_to_thumbnail_file>'
      ```
      
      Where:
      * `<signed_link>`: Signed thumbnail file upload link you got in the previous step.
      * `<image_format>`: Format of the image to upload, such as `png`, `jpeg`, or `gif`. 
      * `<path_to_thumbnail_file>`: Absolute path to the image file to upload. Do not use any shortcuts, including `~`.

  1. Add the thumbnail to your episode:

      ```bash
      curl \
        --request PATCH \
        --url 'https://video.api.cloud.yandex.net/video/v1/episodes/<episode_ID>' \
        --header 'Authorization: Bearer <IAM_token>' \
        --header 'Content-Type: application/json' \
        --data '{
          "fieldMask": "thumbnailId",
          "thumbnailId": "<thumbnail_ID>"
        }'
      ```

      Where:
      * `<episode_ID>`: Previously saved episode ID you want to add a thumbnail for.
      * `<IAM_token>`: IAM token you got before you started.
      * `<thumbnail_ID>`: Previously saved thumbnail ID.

      Result:

      ```text
      {
       "done": true,
       "metadata": {
        "@type": "type.googleapis.com/yandex.cloud.video.v1.UpdateEpisodeMetadata",
        "episodeId": "vpleof6lm40k********"
       },
       "response": {
        "@type": "type.googleapis.com/yandex.cloud.video.v1.Episode",
        "id": "vpleof6lm40k********",
        "streamId": "vplsfj23t7tf********",
        "lineId": "vplldrpqy42y********",
        "title": "my-first-episode",
        "thumbnailId": "vpltxnjvjyzy********",
        "visibilityStatus": "PUBLISHED",
        "createdAt": "2024-11-03T16:55:32.976950Z",
        "updatedAt": "2024-11-03T17:21:31.672357Z"
       },
       "id": "vplpgadtyvhm********",
       "description": "Episode update",
       "createdAt": "2024-11-03T17:21:31.680037Z",
       "createdBy": "ajeol2afu1js********",
       "modifiedAt": "2024-11-03T17:21:31.680037Z"
      }
      ```

- gRPC API {#grpc-api}

  1. Getting started:
  
      * [Get](../../../organization/operations/organization-get-id.md) the ID of the organization your Cloud Video [channel](../../concepts/index.md#channels) belongs to.
      * [Get](../../api-ref/authentication.md) an IAM token, which is required for authentication in the Cloud Video API.
      * To use the examples, install [cURL](https://curl.haxx.se), [gRPCurl](https://github.com/fullstorydev/grpcurl), and [jq](https://stedolan.github.io/jq).
  1. Get a list of Cloud Video channels in your organization:

      ```bash
      grpcurl \
        -rpc-header "Authorization: Bearer <IAM_token>" \
        -d '{
          "organizationId": "<organization_ID>"
        }' \
        video.api.cloud.yandex.net:443 yandex.cloud.video.v1.ChannelService/List
      ```
      
      Where:
      * `<IAM_token>`: IAM token you got before you started.
      * `<organization_ID>`: Organization ID you got before you started.
      
      Result:
      
      ```text
      {
        "channels": [
          {
            "id": "vplc3neipzso********",
            "organizationId": "bpfaidqca8vd********",
            "title": "my-first-channel",
            "description": "My very first Cloud Video channel",
            "createdAt": "2023-07-07T10:51:48.658737Z",
            "updatedAt": "2023-07-07T10:51:48.658737Z"
          },
          {
            "id": "vplc3vssjcxh********",
            "organizationId": "bpfaidqca8vd********",
            "title": "my-work-channel",
            "createdAt": "2023-08-09T23:32:55.372456Z",
            "updatedAt": "2023-08-09T23:32:55.372456Z"
          },
          {
            "id": "vplc4cfwamlx********",
            "organizationId": "bpfaidqca8vd********",
            "title": "my-personal-channel",
            "createdAt": "2024-03-14T13:48:34.535821Z",
            "updatedAt": "2024-03-14T13:48:34.535821Z"
          },
        ]
      }
      ```
      
      Save the `id` of the channel to whose storage you want to upload the thumbnail.

  1. Get a list of broadcasts on the channel:

      ```bash
      grpcurl \
        -rpc-header "Authorization: Bearer <IAM_token>" \
        -d '{
          "channelId": "<channel_ID>"
        }' \
        video.api.cloud.yandex.net:443 yandex.cloud.video.v1.StreamService/List
      ```

      Where:
      * `<IAM_token>`: IAM token you got before you started.
      * `<channel_ID>`: ID of the channel with the broadcast you want to add a thumbnail for.

      Result:

      ```text
      {
        "streams": [
          {
            "id": "vplsfj23t7tf********",
            "channelId": "vplcdyphvqik********",
            "lineId": "vplldrpqy42y********",
            "title": "my-first-stream",
            "status": "OFFLINE",
            "createdAt": "2024-11-03T16:55:32.976950Z",
            "updatedAt": "2024-11-03T16:55:33.091744Z",
            "onDemand": {}
          },
          {
            "id": "vplsgchsr5gi********",
            "channelId": "vplcdyphvqik********",
            "lineId": "vpllxc2mfleb********",
            "title": "my-new-stream",
            "thumbnailId": "vpltznjxpnyj********",
            "status": "OFFLINE",
            "createdAt": "2024-11-03T16:34:10.617101Z",
            "updatedAt": "2024-11-03T16:35:06.601920Z",
            "onDemand": {}
          }
        ]
      }
      ```

      Save the `id` of the broadcast you want to add a thumbnail for.

  1. Get the list of broadcast episodes:

      ```bash
      grpcurl \
        -rpc-header "Authorization: Bearer <IAM_token>" \
        -d '{
          "stream_id": "<broadcast_ID>"
        }' \
        video.api.cloud.yandex.net:443 yandex.cloud.video.v1.EpisodeService/List
      ```

      Where:
      * `<IAM_token>`: IAM token you got before you started.
      * `<broadcast_ID>`: Previously saved broadcast ID.

      Result:

      ```text
      {
        "episodes": [
          {
            "id": "vpleof6lm40k********",
            "streamId": "vplsfj23t7tf********",
            "lineId": "vplldrpqy42y********",
            "title": "my-first-episode",
            "visibilityStatus": "PUBLISHED",
            "createdAt": "2024-11-03T16:55:32.976950Z",
            "updatedAt": "2024-11-03T16:55:33.091744Z"
          }
        ]
      }
      ```

      Save the `id` of the episode you want to add a thumbnail for.

  1. Register your thumbnail in Cloud Video:

      ```bash
      grpcurl \
        -rpc-header "Authorization: Bearer <IAM_token>" \
        -rpc-header 'Content-Type: application/json' \
        -d '{
          "episode_id": "<episode_ID>"
        }' \
        video.api.cloud.yandex.net:443 yandex.cloud.video.v1.ThumbnailService/Create
      ```

      Where:
      * `<IAM_token>`: IAM token you got before you started.
      * `episode_id`: Previously saved episode ID.

      Result:

      ```text
      {
        "id": "vplpoqhxep6q********",
        "description": "Thumbnail create",
        "createdAt": "2024-11-02T19:04:28.412672Z",
        "createdBy": "ajeol2afu1js********",
        "modifiedAt": "2024-11-02T19:04:28.412672Z",
        "done": true,
        "metadata": {
          "@type": "type.googleapis.com/yandex.cloud.video.v1.CreateThumbnailMetadata",
          "thumbnailId": "vpltleyrfnjh********"
        },
        "response": {
          "@type": "type.googleapis.com/yandex.cloud.video.v1.Thumbnail",
          "channelId": "vplcdyphvqik********",
          "createdAt": "2024-11-02T19:04:28.402787Z",
          "episodeId": "vpleof6lm40k********",
          "id": "vpltleyrfnjh********"
        }
      }
      ```

      Save the `thumbnailId` value: you will need it later.

  1. Get a thumbnail upload link:

      ```bash
      grpcurl \
        -rpc-header "Authorization: Bearer <IAM_token>" \
        -d '{
          "thumbnailId": "<thumbnail_ID>"
        }' \
        video.api.cloud.yandex.net:443 yandex.cloud.video.v1.ThumbnailService/GenerateUploadURL | jq
      ```

      Where:
      * `<IAM_token>`: IAM token you got before you started.
      * `<thumbnail_ID>`: Previously saved thumbnail ID.
      
      Result:
      
      ```text
      {
        "uploadUrl": "https://storage.yandexcloud.net/videoplatform-thumbnail/vpltleyrfnjh********?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=********3aBOmv27nzbJZaEHZ%2F20241102%2Fru-central1%2Fs3%2Faws4_request&X-Amz-Date=20241102T190000Z&X-Amz-Expires=43200&X-Amz-Signature=057fe4c0da26c7758474f5eaa85ff41d7212632572fb636ed6d8f65d039c309b&X-Amz-SignedHeaders=host"
      }
      ```
      
      The `uploadUrl` field contains a signed link you can use to upload the thumbnail file.

  1. Upload an image file to the thumbnail:

      ```
      curl \
        --request PUT \
        --url '<signed_link>' \
        --header 'Content-Type: image/<image_format>' \
        --upload-file '<path_to_thumbnail_file>'
      ```
      
      Where:
      * `<signed_link>`: Signed thumbnail file upload link you got in the previous step.
      * `<image_format>`: Format of the image to upload, such as `png`, `jpeg`, or `gif`. 
      * `<path_to_thumbnail_file>`: Absolute path to the image file to upload. Do not use any shortcuts, including `~`.

  1. Add the thumbnail to your episode:

      ```bash
      grpcurl \
        -rpc-header "Authorization: Bearer <IAM_token>" \
        -rpc-header "Content-Type: application/json" \
        -d '{
          "episode_id": "<episode_ID>",
          "field_mask": {"paths": ["thumbnail_id"]},
          "thumbnail_id": "<thumbnail_ID>"
        }' \
        video.api.cloud.yandex.net:443 yandex.cloud.video.v1.EpisodeService/Update
      ```

      Where:
      * `<IAM_token>`: IAM token you got before you started.
      * `<episode_ID>`: Previously saved episode ID you want to add a thumbnail for.
      * `<thumbnail_ID>`: Previously saved thumbnail ID.

      Result:

      ```text
      {
        "id": "vplpl2wqhe62********",
        "description": "Episode update",
        "createdAt": "2024-11-03T17:29:26.987297Z",
        "createdBy": "ajeol2afu1js********",
        "modifiedAt": "2024-11-03T17:29:26.987297Z",
        "done": true,
        "metadata": {
          "@type": "type.googleapis.com/yandex.cloud.video.v1.UpdateEpisodeMetadata",
          "episodeId": "vpleof6lm40k********"
        },
        "response": {
          "@type": "type.googleapis.com/yandex.cloud.video.v1.Episode",
          "createdAt": "2024-11-03T16:55:32.976950Z",
          "id": "vpleof6lm40k********",
          "lineId": "vplldrpqy42y********",
          "streamId": "vplsfj23t7tf********",
          "thumbnailId": "vpltxnjvjyzy********",
          "title": "my-first-episode",
          "updatedAt": "2024-11-03T17:29:26.986096Z",
          "visibilityStatus": "PUBLISHED"
        }
      }
      ```

{% endlist %}