openapi: 3.1.0
info:
  title: MEGOGO Content API (partner subset)
  version: 1.0.0
  summary: Catalog, metadata, user authorization and playback for partner applications.
  description: "This specification describes the Content API endpoints that\npartners use to show MEGOGO\
    \ content in their applications.\n\n\n## Request signature\n\nAll requests must have the `sign` query\
    \ parameter:\n\n1. Join the request parameters as `name=value` with no separator, in the\n   same\
    \ order as in the URL. Do not include `sign`.\n2. Add the private key at the end. Calculate the MD5\
    \ hash (lowercase hex).\n3. Add the public key at the end of the hash.\n\n`sign = md5(\"p1=v1p2=v2…\"\
    \ + private_key) + public_key`\n\nPut `sign` as the last parameter. A request without parameters has\n\
    `sign = md5(private_key) + public_key`.\n\n## Response envelope\n\nAll responses have the fields `result`\
    \ (`ok` or `error`), `code` and\n`data`. An error response has `message`.\n\nWARNING: Most errors\
    \ come with HTTP status 200. For example, an\nunknown video ID gives HTTP 200 with `\"result\": \"\
    error\", \"code\": 404`.\nCheck `result` and `code`, not the HTTP status. A wrong `sign` gives\nHTTP\
    \ 400.\n\n## Catalog and `/video/info`\n\nYou can build the catalog in two ways: import the XML feed,\
    \ or build\nthe screens with the list requests of this API. Send `/video/info` only\nafter a user\
    \ action (the user opens the page of a video). Do not use it\nto collect metadata for many videos.\n\
    \n## Pagination\n\nUse the token strategy for all list requests:\n\n1. Send the first request with\
    \ `paging_strategy=token`.\n2. If the response has `next_page`, there are more items. To get the\n\
    \   next page, send the same request and add `page={next_page}`.\n3. If the response has no `next_page`,\
    \ this is the last page.\n\nThe `page` value is an encoded position. Do not change it and do not\n\
    make it yourself. Put `page` in the signature like all other\nparameters. Responses in this mode have\
    \ `next_page` and `prev_page`,\nbut no `total`, `offset` and `has_more`.\n\nDo not use `offset` and\
    \ `limit`. MEGOGO is going to remove them. The\npage size is 20 items.\n\n## Language\n\nSend `lang`\
    \ in each request. If `lang` is not sent, the API uses the\n`Accept-Language` header. For an unknown\
    \ header value, the text is in\nRussian.\n\n## Limits\n\n1000 requests per minute for each key. Above\
    \ this limit, you can get\nHTTP 429 Too Many Requests. The responses have no rate-limit\nheaders.\n\
    \n## Geolocation\n\nIf your application sends `/stream` from the user device, MEGOGO finds\nthe country\
    \ of the user from the IP address (MaxMind database). If your\nserver sends the requests, MEGOGO turns\
    \ on a fixed (\"overridden\") region\nfor your key, and you must control the location of your users.\n\
    \n## Test keys\n\nThere is no separate test environment. MEGOGO gives each partner a test\npartner\
    \ ID (for example `testprod_ua`) and test keys on production.\n"
  contact:
    name: MEGOGO partner integration team
servers:
- url: https://api.megogo.net/v1
  description: 'Production

    '
tags:
- name: Authorization
- name: Configuration
- name: Catalog
- name: Video
- name: Playback
security:
- signature: []
paths:
  /auth/by_partners:
    get:
      tags:
      - Authorization
      operationId: authorizeUser
      summary: Authorize an end user of the partner
      description: 'Gets an access token for an end user who has a subscription or a

        purchase in the MEGOGO partner billing. Add `access_token` to

        `/stream` and to the other requests that need the user.


        This is the only authorization method for partner applications. Authorization with a cookie is
        a legacy method. Do not use

        it. When the access token expires, get a new one. The time

        and the method (a new `auth/by_partners` request, or the

        `remember_me_token`) depend on your platform.


        `token = md5(user_identifier + partner_id + salt)`.


        If MEGOGO does not know the user identifier, the request makes a

        MEGOGO account for it. The access token lives about 6 hours,

        the remember-me token about 5 years. The response also has

        profile fields and `is_new_user`. Do not use them.

        '
      parameters:
      - name: isdn
        in: query
        required: true
        description: 'The user identifier on the partner side (the same value as `userId` in the billing
          requests).

          '
        schema:
          type: string
          maxLength: 255
      - name: partner_key
        in: query
        required: true
        description: 'The partner ID.

          '
        schema:
          type: string
      - name: token
        in: query
        required: true
        description: 'The authorization token (MD5 hex).

          '
        schema:
          type: string
          pattern: ^[a-f0-9]{32}$
      - $ref: '#/components/parameters/sign'
      responses:
        '200':
          description: 'The user is authorized.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthResponse'
        '400':
          $ref: '#/components/responses/Error'
  /auth/refresh:
    get:
      tags:
      - Authorization
      operationId: refreshAccessToken
      summary: Get a new access token with the remember-me token
      description: 'Gets a new access token for a user without the authorization token.

        Use the `remember_me_token` from `/auth/by_partners`.


        NOTE: The parameter name is `rememberme_token` (without the second

        underscore). The name `remember_me_token` gives an error.


        If the previous access token is still valid, the response can

        contain the same access token.

        '
      parameters:
      - name: rememberme_token
        in: query
        required: true
        description: 'The `remember_me_token` value from `/auth/by_partners` or from the previous `/auth/refresh`.

          '
        schema:
          type: string
      - $ref: '#/components/parameters/sign'
      responses:
        '200':
          description: 'New tokens. The same structure as `/auth/by_partners`.

            A token that is not valid gives `"result": "error", "code": 400`

            with HTTP 200.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthResponse'
        '400':
          $ref: '#/components/responses/Error'
  /configuration:
    get:
      tags:
      - Configuration
      operationId: getConfiguration
      summary: Get the configuration (categories, genres, geo)
      description: 'Get the reference data for the catalog. Keep the response in a cache on your server.

        '
      parameters:
      - $ref: '#/components/parameters/lang'
      - $ref: '#/components/parameters/did'
      - $ref: '#/components/parameters/sign'
      responses:
        '200':
          description: 'The configuration.

            '
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Envelope'
                - type: object
                  properties:
                    data:
                      $ref: '#/components/schemas/Configuration'
        '400':
          $ref: '#/components/responses/Error'
  /collections:
    get:
      tags:
      - Catalog
      operationId: listCollections
      summary: Get the list of collections
      description: 'MEGOGO makes collections for some partners on request.

        Without collections, `collections` is an empty array.

        '
      parameters:
      - name: category_id
        in: query
        description: 'Get only the collections of this category.

          '
        schema:
          type: integer
      - $ref: '#/components/parameters/paging_strategy'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/offset'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/lang'
      - $ref: '#/components/parameters/did'
      - $ref: '#/components/parameters/sign'
      responses:
        '200':
          description: 'A page of collections. The default `limit` is 10.

            '
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Envelope'
                - type: object
                  properties:
                    data:
                      allOf:
                      - $ref: '#/components/schemas/PageMeta'
                      - type: object
                        properties:
                          collections:
                            type: array
                            items:
                              $ref: '#/components/schemas/Collection'
        '400':
          $ref: '#/components/responses/Error'
  /video/collection:
    get:
      tags:
      - Catalog
      operationId: listCollectionVideos
      summary: Get the videos of a collection
      parameters:
      - name: id
        in: query
        required: true
        description: 'The collection ID.

          '
        schema:
          type: integer
      - $ref: '#/components/parameters/paging_strategy'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/offset'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/category_id_filter'
      - $ref: '#/components/parameters/genre'
      - $ref: '#/components/parameters/country'
      - $ref: '#/components/parameters/year_min'
      - $ref: '#/components/parameters/year_max'
      - $ref: '#/components/parameters/vod'
      - $ref: '#/components/parameters/sort'
      - $ref: '#/components/parameters/lang'
      - $ref: '#/components/parameters/access_token'
      - $ref: '#/components/parameters/did'
      - $ref: '#/components/parameters/sign'
      responses:
        '200':
          description: 'A page of videos.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CollectionVideoPage'
        '400':
          $ref: '#/components/responses/Error'
  /video:
    get:
      tags:
      - Catalog
      operationId: listVideos
      summary: Get the videos of a category
      parameters:
      - name: category_id
        in: query
        required: true
        description: 'The category ID from `/configuration`.

          '
        schema:
          type: integer
      - $ref: '#/components/parameters/genre'
      - $ref: '#/components/parameters/sort'
      - $ref: '#/components/parameters/paging_strategy'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/offset'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/country'
      - $ref: '#/components/parameters/year_min'
      - $ref: '#/components/parameters/year_max'
      - name: subscription_id
        in: query
        description: 'Get only the videos of this subscription. (Docs only.)

          '
        schema:
          type: integer
      - $ref: '#/components/parameters/lang'
      - $ref: '#/components/parameters/access_token'
      - $ref: '#/components/parameters/did'
      - $ref: '#/components/parameters/sign'
      responses:
        '200':
          description: 'A page of videos.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoPage'
        '400':
          $ref: '#/components/responses/Error'
  /video/info:
    get:
      tags:
      - Video
      operationId: getVideoInfo
      summary: Get the details of a video
      description: 'Get the metadata and the purchase data of a video.


        **Send this request only after a user action** (the user opens the

        page of the video). Do not use `/video/info` to collect metadata for

        many videos one after another. To build the catalog, use the XML feed

        or the list requests (`/video`, `/video/collection`, `/catalog/objects`).


        For a paid video, make sure that `purchase_info` is in the response.

        If it is not, do not show the purchase options.


        With `access_token`, `is_available` shows if the user can watch the video.

        '
      parameters:
      - name: id
        in: query
        required: true
        description: 'The video ID.

          '
        schema:
          type: integer
      - name: root_object
        in: query
        description: '`1` = data of the episode, `0` = data of the series. (Docs only.)

          '
        schema:
          type: integer
          enum:
          - 0
          - 1
      - $ref: '#/components/parameters/lang'
      - $ref: '#/components/parameters/access_token'
      - $ref: '#/components/parameters/did'
      - $ref: '#/components/parameters/sign'
      responses:
        '200':
          description: 'The video details.

            '
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Envelope'
                - type: object
                  properties:
                    data:
                      $ref: '#/components/schemas/VideoInfo'
        '400':
          $ref: '#/components/responses/Error'
  /video/episodes:
    get:
      tags:
      - Video
      operationId: listSeasonEpisodes
      summary: Get the episodes of a season
      description: '`data` is an array of episodes. If the season ID is not correct or

        not available, `data` is an empty array (no error).


        NOTE: `/video/info` for a series gives `season_list`. Only the first

        season has `episode_list` with episodes. For the other seasons,

        `episode_list` is empty: use this request with the season ID.

        The series ID gives an empty array.

        '
      parameters:
      - name: id
        in: query
        required: true
        description: 'The season ID (`season_list[].id` in `/video/info`).

          '
        schema:
          type: integer
      - $ref: '#/components/parameters/lang'
      - $ref: '#/components/parameters/access_token'
      - $ref: '#/components/parameters/did'
      - $ref: '#/components/parameters/sign'
      responses:
        '200':
          description: 'The episodes.

            '
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Envelope'
                - type: object
                  properties:
                    data:
                      type: array
                      items:
                        $ref: '#/components/schemas/Episode'
        '400':
          $ref: '#/components/responses/Error'
  /search:
    get:
      tags:
      - Catalog
      operationId: searchVideos
      summary: Search videos by text
      parameters:
      - name: text
        in: query
        required: true
        description: 'The search text.

          '
        schema:
          type: string
      - $ref: '#/components/parameters/category_id_filter'
      - $ref: '#/components/parameters/paging_strategy'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/offset'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/lang'
      - $ref: '#/components/parameters/did'
      - $ref: '#/components/parameters/sign'
      responses:
        '200':
          description: 'A page of videos.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoPage'
        '400':
          $ref: '#/components/responses/Error'
  /stream:
    get:
      tags:
      - Playback
      operationId: getStream
      summary: Get the stream URL of a video
      description: 'Get the manifest URL, the DRM data, the bitrates, the audio tracks and

        the subtitles of a video.


        **Important:** if the user cannot watch the video, the response is

        HTTP 200 with `result: ok`, an empty `src` and a `restrictions` array.

        Always check `src` and `restrictions`.


        WARNING: The stream URL contains the access token and user data. Do

        not keep the URL in a cache, do not write it to logs, do not share it.


        Send this request from the end-user device. If you send it from your

        server, you are responsible for the geo of the user.


        The DRM type comes from the settings of the API key.


        WARNING: For a rented (TVOD) video, the first response with `src`

        starts the rent period. Send this request only when the user

        starts the playback. Do not send it to prepare or to check the

        stream.

        '
      parameters:
      - name: video_id
        in: query
        required: true
        description: 'The ID of the film, the episode or the trailer. For the ID of a

          series, the response gives the first episode.

          '
        schema:
          type: integer
      - name: bitrate
        in: query
        description: 'Get the stream for this bitrate only. (Docs only.)

          '
        schema:
          type: integer
      - $ref: '#/components/parameters/lang'
      - $ref: '#/components/parameters/access_token'
      - $ref: '#/components/parameters/did'
      - $ref: '#/components/parameters/sign'
      responses:
        '200':
          description: 'The stream data, or restrictions if the video is not available.

            '
          content:
            application/json:
              schema:
                allOf:
                - $ref: '#/components/schemas/Envelope'
                - type: object
                  properties:
                    data:
                      $ref: '#/components/schemas/Stream'
        '400':
          $ref: '#/components/responses/Error'
  /video/recommended:
    get:
      tags:
      - Catalog
      operationId: listRecommendedVideos
      summary: Get recommendations that do not depend on the user
      description: '`data`: `limit`, `version`, `video_list` ( 12 videos for a

        film). `recommended_videos` in `/video/info` was empty for the same

        film.

        '
      parameters:
      - name: video_id
        in: query
        description: 'Get recommendations for this video.

          '
        schema:
          type: integer
      - $ref: '#/components/parameters/paging_strategy'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/offset'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/lang'
      - $ref: '#/components/parameters/sign'
      responses:
        '200':
          description: 'A page of videos.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoPage'
  /catalog/filters:
    get:
      tags:
      - Catalog
      operationId: getCatalogFilters
      summary: Get the available catalog filters and sort options
      description: 'The filters that your key can use in `/catalog/objects`.

        MEGOGO turns on the catalog filters for a key. Without them,

        `filter_by` is an empty array: then use the filters of

        `/video`.


        Each item of `filter_by` has `id` (the name of the query parameter

        of `/catalog/objects`), `multichoice` (more than one value, separated

        by commas), `inline` and `items` (`id`, `slug`, `enabled`; `title`

        with `show_title=true`). Filters of the test key: `category_id`,

        `video_genre_id`, `country_id`, `year_id`, `audiotrack_id`,

        `subtitle_id`, `video_quality` (`hd`, `hdr`, `4k`), `vod_free`,

        `vod_sub`, `vod_buy`, `finger_language`, `audio_description`.


        The sort options (`order_by`: `popular`, `add`, `novelty`,

        `rating_megogo`, `rating_imdb`, `recommended`) are in the response

        only with `show_disabled_items=true`.

        '
      parameters:
      - name: show_title
        in: query
        description: '`true`: add `title` to the filters and the items.

          '
        schema:
          type: boolean
      - name: show_disabled_items
        in: query
        description: '`true`: add the items with `enabled: false` and `order_by`.

          '
        schema:
          type: boolean
      - name: category_id
        in: query
        schema:
          type: integer
      - name: video_genre_id
        in: query
        schema:
          type: string
      - $ref: '#/components/parameters/lang'
      - $ref: '#/components/parameters/sign'
      responses:
        '200':
          description: 'Filters (`filter_by`) and sort options (`order_by`).

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope'
  /catalog/objects:
    get:
      tags:
      - Catalog
      operationId: listCatalogObjects
      summary: Get the catalog items for the selected filters
      description: '`data.groups[]` with `limit`, `next_page`, `content_type` and

        `videos`. Send each filter of `/catalog/filters` as a

        query parameter with the `id` of an item, for example

        `video_genre_id=2,25`, `country_id=2`, `video_quality=4k`,

        `vod_buy=true`. An item ID that is not correct gives

        `code 400`.

        '
      parameters:
      - name: category_id
        in: query
        schema:
          type: integer
      - name: video_genre_id
        in: query
        description: 'Genre IDs, separated by commas.

          '
        schema:
          type: string
      - name: country_id
        in: query
        schema:
          type: string
      - name: year_id
        in: query
        schema:
          type: string
      - name: audiotrack_id
        in: query
        schema:
          type: string
      - name: subtitle_id
        in: query
        schema:
          type: string
      - name: video_quality
        in: query
        schema:
          type: string
          examples:
          - hd
          - hdr
          - 4k
      - name: vod_free
        in: query
        schema:
          type: boolean
      - name: vod_sub
        in: query
        schema:
          type: boolean
      - name: vod_buy
        in: query
        schema:
          type: boolean
      - name: sort
        in: query
        description: 'A value of `order_by` from `/catalog/filters`, for example `popular`, `add`.

          '
        schema:
          type: string
      - $ref: '#/components/parameters/paging_strategy'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/offset'
      - $ref: '#/components/parameters/limit'
      - $ref: '#/components/parameters/lang'
      - $ref: '#/components/parameters/sign'
      responses:
        '200':
          description: 'Groups of catalog items.

            '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Envelope'
components:
  securitySchemes:
    signature:
      type: apiKey
      in: query
      name: sign
      description: 'The request signature. See "Request signature" in the description.

        '
  parameters:
    sign:
      name: sign
      in: query
      required: true
      description: '`md5(params + private_key) + public_key`. Put it as the last parameter.

        '
      schema:
        type: string
        pattern: ^[a-f0-9]{32}_.+$
    lang:
      name: lang
      in: query
      description: 'The language of the text. MEGOGO language codes, for example `ru`,

        `ua`, `en`, `kz`, `pl`. Send it in each request.

        '
      schema:
        type: string
    did:
      name: did
      in: query
      description: 'The device ID. Not necessary.

        '
      schema:
        type: string
    access_token:
      name: access_token
      in: query
      description: 'The access token from `/auth/by_partners`. It is part of the

        signature. Lifetime ≈ 6 hours.

        '
      schema:
        type: string
    paging_strategy:
      name: paging_strategy
      in: query
      description: 'Send `token` in each list request. Then the response has

        `next_page` instead of `offset`, `total` and `has_more`.

        '
      schema:
        type: string
        enum:
        - token
    page:
      name: page
      in: query
      description: 'The `next_page` value from the previous response. Do not send it in

        the first request. Do not change the value.

        '
      schema:
        type: string
        examples:
        - PjIw
    offset:
      name: offset
      in: query
      deprecated: true
      description: 'Old pagination. Do not use it. Use `paging_strategy=token`.

        '
      schema:
        type: integer
        minimum: 0
        default: 0
    limit:
      name: limit
      in: query
      deprecated: true
      description: 'Old pagination. Do not use it. Without `limit`, a page has 20

        items.

        '
      schema:
        type: integer
        minimum: 1
        default: 20
    category_id_filter:
      name: category_id
      in: query
      description: 'Filter by category ID.

        '
      schema:
        type: integer
    genre:
      name: genre
      in: query
      description: 'Filter by genre IDs, separated by commas.

        '
      schema:
        type: string
        examples:
        - 2,25
    country:
      name: country
      in: query
      description: 'Filter by country IDs, separated by commas.

        '
      schema:
        type: string
    year_min:
      name: year_min
      in: query
      description: 'The first release year (included).

        '
      schema:
        type: integer
    year_max:
      name: year_max
      in: query
      description: 'The last release year (included).

        '
      schema:
        type: integer
    vod:
      name: vod
      in: query
      description: 'Filter by delivery rules, separated by commas (`svod,tvod,...`).

        '
      schema:
        type: string
    sort:
      name: sort
      in: query
      description: 'The sort order: `popular`, `add` (new on MEGOGO), `year` (newest

        first). Verified: `year`, `popular`, `add`. Without

        `sort`, the order is not `popular`. An unknown value is

        ignored without an error.

        '
      schema:
        type: string
        enum:
        - recommended
        - add
        - popular
        - year
  responses:
    Error:
      description: 'Error. Example: wrong signature → HTTP 400 with

        `message: "You entered wrong sign key"`. The full list of errors

        is not confirmed.

        '
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Envelope'
          example:
            result: error
            code: 400
            message: You entered wrong sign key
  schemas:
    Envelope:
      type: object
      required:
      - result
      - code
      properties:
        result:
          type: string
          enum:
          - ok
          - error
        code:
          type: integer
          description: 'Repeats the HTTP status.

            '
        message:
          type: string
          description: 'Error text. Only when `result` is `error`.

            '
    PageMeta:
      type: object
      properties:
        limit:
          type: integer
        next_page:
          type: string
          description: 'Token pagination. The `page` value for the next page. Not in the response on the
            last page.

            '
        prev_page:
          type: string
          description: 'Token pagination. The `page` value for the previous page. Not in the response
            on the first page.

            '
        offset:
          type: integer
          deprecated: true
          description: 'Old pagination only.

            '
        total:
          type: integer
          deprecated: true
          description: 'Old pagination only. The number of all items.

            '
        has_more:
          type: boolean
          deprecated: true
          description: 'Old pagination only.

            '
    VideoPage:
      allOf:
      - $ref: '#/components/schemas/Envelope'
      - type: object
        properties:
          data:
            allOf:
            - $ref: '#/components/schemas/PageMeta'
            - type: object
              properties:
                video_list:
                  type: array
                  items:
                    $ref: '#/components/schemas/VideoShort'
    CollectionVideoPage:
      allOf:
      - $ref: '#/components/schemas/Envelope'
      - type: object
        properties:
          data:
            allOf:
            - $ref: '#/components/schemas/PageMeta'
            - type: object
              properties:
                title:
                  type: string
                  description: 'The collection title.

                    '
                url:
                  type: string
                featured_source:
                  type: string
                external_type:
                  type: string
                custom_html:
                  type: string
                video_list:
                  type: array
                  items:
                    $ref: '#/components/schemas/VideoShort'
    Image:
      type: object
      description: 'Poster URLs. Some values can be empty strings.


        CAUTION: The keys `image_470х270` and `image_215х120` contain the

        Cyrillic letter `х` (U+0445), not the Latin `x`. Use the keys exactly

        as they are. MEGOGO does not plan to change them. The image

        sizes can change: do not make your layout depend on them.

        '
      properties:
        big:
          type: string
          format: uri
        small:
          type: string
          format: uri
        original:
          type: string
          format: uri
        original_wide:
          type: string
        fullscreen:
          type: string
          format: uri
        image_470х270:
          type: string
        image_215х120:
          type: string
    DeliveryRule:
      type: string
      description: 'The business model of the video. `advod` and `fvod` streams do not

        need a user. In a partner application, `svod`, `fvod` and

        `advod` videos are part of the partner subscription: the partner

        controls access.

        '
      enum:
      - advod
      - fvod
      - svod
      - tvod
      - dto
    VideoShort:
      type: object
      description: 'A video in a list.

        '
      properties:
        item_type:
          type: string
          examples:
          - video
          - series
        id:
          type: integer
        title:
          type: string
        image:
          $ref: '#/components/schemas/Image'
        country:
          type: string
        countries:
          type: array
          items:
            type: integer
        year:
          type: string
          description: 'Can be a range for a series, for example "2010 - 2018".

            '
        slug:
          type: string
        categories:
          type: array
          items:
            type: integer
        genres:
          type: array
          items:
            type: integer
        age_limit:
          type: string
          examples:
          - '0'
          - '6'
          - '12'
          - '16'
          - '18'
        rating_imdb:
          type: string
        rating_kinopoisk:
          type: string
        rating_megogo:
          type: string
        duration:
          type: integer
          description: 'Seconds.

            '
        quality:
          type: string
          examples:
          - Full HD
        watched_progress_percent:
          type: integer
        is_exclusive:
          type: boolean
        is_sport:
          type: boolean
        show:
          type: string
        delivery_rules:
          type: array
          items:
            $ref: '#/components/schemas/DeliveryRule'
    VideoInfo:
      type: object
      description: 'Verified fields. `delivery_rules`, `is_series`, `drm_types`,

        `is_wvdrm`, `restriction` and `audio_list` from the old documentation

        were not in the response.

        '
      properties:
        item_type:
          type: string
          examples:
          - video
          - series
        type:
          type: string
          examples:
          - VIDEO
          - SERIES
        video_type:
          type: string
          examples:
          - FILM
          - SERIAL
        id:
          type: integer
        title:
          type: string
        title_original:
          type: string
        image:
          $ref: '#/components/schemas/Image'
        country:
          type: string
        countries:
          type: array
          items:
            type: integer
        year:
          type: string
        slug:
          type: string
        categories:
          type: array
          items:
            type: integer
        age_limit:
          type: string
        rating_imdb:
          type: string
        rating_kinopoisk:
          type: string
        rating_megogo:
          type: string
        duration:
          type: integer
          description: 'Seconds.

            '
        trailer_id:
          type: integer
          description: 'Use it as `video_id` in `/stream` to play the trailer.

            '
        quality:
          type: string
          examples:
          - Full HD
        description:
          type: string
        short_description:
          type: string
        people:
          type: array
          items:
            type: object
        screenshots:
          type: array
          items:
            type: object
        season_list:
          type: array
          items:
            $ref: '#/components/schemas/Season'
        subtitles:
          type: array
          items:
            type: string
        recommended_videos:
          type: array
          items:
            $ref: '#/components/schemas/VideoShort'
        purchase_info:
          $ref: '#/components/schemas/PurchaseInfo'
        is_available:
          type: boolean
          description: '`true` if the user (from `access_token`) can watch the video.

            '
        is_selling:
          type: boolean
        allow_external_streaming:
          type: boolean
          description: 'AirPlay and Chromecast are permitted.

            '
        is_embed:
          type: boolean
        is_promocode:
          type: boolean
        is_favorite:
          type: boolean
        video_url:
          type: string
        full_url:
          type: string
        watch_target:
          type: object
        watched_progress_percent:
          type: integer
        vote:
          type: integer
        vote_type:
          type: string
        like:
          type: integer
        dislike:
          type: integer
        comments_num:
          type: integer
        vod_channel:
          type: boolean
        dvr:
          type: boolean
        tv:
          type: boolean
    PurchaseService:
      type: object
      description: 'A TVOD or DTO offer. Other fields can be in the response.

        '
      additionalProperties: true
      properties:
        subscription_id:
          type: integer
          description: 'The ID of the offer (service).

            '
        title:
          type: string
        currency_code:
          type: string
          examples:
          - uah
        is_bought:
          type: boolean
          description: '`true` if the user already bought it. Only with `access_token`.

            '
        tariffs:
          type: array
          items:
            type: object
            properties:
              tariff_id:
                type: integer
                description: 'The tariff ID. Use it as `serviceId` in `buyMovie`. It is not the `tariff_id`
                  of the XML feed.

                  '
              price:
                type: number
              period:
                type: integer
                description: 'Access period in days.

                  '
              quality:
                type: object
                properties:
                  group:
                    type: string
                    examples:
                    - HD
                    - SD
                  title:
                    type: string
                    examples:
                    - Full HD
                    - SD
                  bitrate:
                    type: integer
                    examples:
                    - 1080
                    - 576
              is_bought:
                type: boolean
    PurchaseInfo:
      type: object
      description: 'How the user can get access. SVOD, TVOD and DTO shapes verified. The object contains
        only the delivery rules that are

        enabled on your key.

        '
      properties:
        svod:
          type: object
          properties:
            subscriptions:
              type: array
              description: 'Service IDs that include this video.

                '
              items:
                type: integer
        tvod:
          type: object
          description: 'Verified. Rent offers of the video for your key.

            '
          properties:
            subscriptions:
              type: array
              items:
                $ref: '#/components/schemas/PurchaseService'
        dto:
          type: object
          description: 'Verified. The same shape as `tvod`. `period` is the access period in days, for
            example 3650. Show it as "forever".

            '
          properties:
            subscriptions:
              type: array
              items:
                $ref: '#/components/schemas/PurchaseService'
        advod:
          type: object
          properties:
            subscriptions:
              type: array
              items:
                type: integer
        fvod:
          type: object
          properties:
            subscriptions:
              type: array
              items:
                type: integer
    Season:
      type: object
      properties:
        id:
          type: integer
          description: 'The season ID. Use it in `/video/episodes`.

            '
        order:
          type: integer
        title:
          type: string
        title_original:
          type: string
        total:
          type: integer
          description: 'The number of episodes. Can be more than the items in `episode_list`.

            '
        episode_list:
          type: array
          items:
            $ref: '#/components/schemas/Episode'
    Episode:
      type: object
      properties:
        id:
          type: integer
          description: 'The episode ID. Use it as `video_id` in `/stream`.

            '
        order:
          type: integer
        title:
          type: string
        title_original:
          type: string
        description:
          type: string
        duration:
          type: integer
          description: 'Seconds.

            '
        image:
          type: string
          format: uri
        images:
          type: object
          properties:
            image_115x120:
              type: string
              format: uri
            image_126x71:
              type: string
              format: uri
            image_162x100:
              type: string
              format: uri
            image_640x360:
              type: string
              format: uri
            image_800x450:
              type: string
              format: uri
            image_original:
              type: string
              format: uri
        is_embed:
          type: boolean
        slug:
          type: string
        watched_progress_percent:
          type: integer
    Collection:
      type: object
      description: '(Docs only. The test key had no collections.)

        '
      properties:
        id:
          type: integer
        title:
          type: string
        path:
          type: string
        image:
          type: object
          properties:
            image_horizontal:
              type: string
              format: uri
            image_vertical:
              type: string
              format: uri
    Configuration:
      type: object
      description: 'Verified keys. Other keys can be in the response.

        '
      additionalProperties: true
      properties:
        geo:
          type: string
          description: 'The country of the user, for example `kz`.

            '
        partner_id:
          type: integer
          description: 'The number of your partner account. It is not the partner ID string. The same
            number is in the URL of your XML feed.

            '
        free_vod_types:
          type: array
          items:
            type: string
          examples:
          - - ADVOD
            - FVOD
        categories:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              title:
                type: string
        genres:
          type: array
          items:
            type: object
        member_types:
          type: array
          items:
            type: object
        age_limits:
          type: array
          items:
            type: object
        video_country_filters:
          type: array
          items:
            type: object
        video_year_filters:
          type: array
          items:
            type: object
        bitrate_from:
          type: integer
        bitrate_to:
          type: integer
        download:
          type: object
          properties:
            enabled:
              type: boolean
        force_update:
          type: object
          properties:
            is_update:
              type: boolean
        order_strategy:
          type: string
        support_info:
          type: object
        payment_systems:
          type: array
          items: {}
    AuthResponse:
      allOf:
      - $ref: '#/components/schemas/Envelope'
      - type: object
        properties:
          data:
            type: object
            properties:
              user_id:
                type: integer
                description: 'The MEGOGO user ID.

                  '
              tokens:
                type: object
                properties:
                  access_token:
                    type: string
                    description: 'Use in Content API requests.

                      '
                  access_token_expires_at:
                    type: integer
                    description: 'Unix time. ≈ 6 hours after authorization.

                      '
                  remember_me_token:
                    type: string
                    description: 'Send it as `rememberme_token` to `/auth/refresh` to get a new access
                      token.

                      '
                  remember_me_token_expires_at:
                    type: integer
                    description: 'Unix time. ≈ 5 years after authorization.

                      '
              is_new_user:
                type: boolean
              is_autouser:
                type: boolean
              extra:
                type: object
                properties:
                  access_key:
                    type: string
                    description: 'Purpose not documented.

                      '
    Restriction:
      type: object
      properties:
        code:
          type: string
          description: 'The reason why the video is not available. Known values:

            `NOT_PURCHASABLE`, `BIZ_CLASS`, `NO_CONTRACT`, `CONTRACT`,

            `NOT_ENABLED_IN_COUNTRY`, `NO_VOD_COUNTRY`, `DRM`,

            `NO_DRM_SUPPORT`, `PARTNER_IS_DISABLED`, `NO_BITRATE` (for

            example a 4K version on a key without the 4K setting),

            `BITRATE_DISABLED_BY_PURCHASED_SUBSCRIPTION`,

            `UHD_IS_NOT_SUPPORTED`, `HDR_IS_NOT_SUPPORTED`,

            `D3_IS_NOT_SUPPORTED`, `NO_SCHEDULE_FOR_CHANNEL`,

            `INVALID_VIRTUAL_OBJECT_ID`, `CATCH_UP_IS_UNAVAILABLE`.

            '
          examples:
          - NOT_PURCHASABLE
        message:
          type: string
          description: 'A generic text. Do not show it as the reason.

            '
    Stream:
      type: object
      properties:
        video_id:
          type: integer
        root_video_id:
          type: integer
          description: 'The series ID. Only for an episode.

            '
        title:
          type: string
        hierarchy_titles:
          type: object
          description: '`VIDEO` for a film. `SERIES`, `SEASON`, `EPISODE` for an episode.

            '
          additionalProperties:
            type: string
        is_hierarchy:
          type: boolean
        prev:
          type: integer
          description: 'The previous episode ID. Not in the response for the first episode.

            '
        next:
          type: integer
          description: 'The next episode ID. Not in the response for the last episode.

            '
        src:
          type: string
          description: 'The manifest URL. Empty if the video is not available (see

            `restrictions`). HLS (`.m3u8`) or DASH (`.mpd`).

            Request a new `src` each time the user starts the playback. Do

            not keep or cache this URL.

            '
        stream_type:
          type: string
          enum:
          - hls
          - dash
          - mss
          description: 'Only when `src` is not empty. The protocol is set on the key. All values verified.
            For `mss`,

            the `src` path ends with `/Manifest`.

            '
        content_type:
          type: string
          description: 'Verified value `vod`. Other documented values `tv_dvr`, `tv_linear`, `m_ch`, `live`,
            `live_dvr`, `trailer`.

            '
        drm_type:
          type: string
          description: 'Empty string if there is no DRM. The DRM system is set on the key: `modular` (Widevine,
            DASH), `playready` (PlayReady, DASH),

            `fairplay` (FairPlay, HLS). The old documentation also lists

            `widevine`.

            '
          enum:
          - ''
          - modular
          - widevine
          - playready
          - fairplay
        license_server:
          type: string
          description: 'The DRM license URL. Empty if there is no DRM.

            '
        license_certificate:
          type: string
          description: 'The certificate URL. FairPlay only. Empty for the other DRM systems.

            '
        is_wvdrm:
          type: boolean
          deprecated: true
          description: 'Always `false`. Use `drm_type`.

            '
        restrictions:
          type: array
          description: 'Only when the video is not available.

            '
          items:
            $ref: '#/components/schemas/Restriction'
        bitrates:
          type: array
          items:
            $ref: '#/components/schemas/Bitrate'
        audio_tracks:
          type: array
          items:
            $ref: '#/components/schemas/AudioTrack'
        subtitles:
          type: array
          items:
            $ref: '#/components/schemas/Subtitle'
        advert_url:
          type: string
          description: 'Not for partner use. Ignore this field.

            '
        start_session_url:
          type: string
          description: 'View statistics URL.

            '
        allow_external_streaming:
          type: boolean
        parental_control_required:
          type: boolean
        play_start_time:
          type: integer
          description: 'Seconds. The position where the user stopped last time.

            '
        credits_start:
          type: integer
          description: 'Seconds. The start of the end credits.

            '
        preview_images:
          type: object
          properties:
            thumbsline_xml:
              type: string
              format: uri
            thumbsline_list:
              type: array
              items:
                $ref: '#/components/schemas/Thumb'
            thumbsline_list_full_hd:
              type: array
              items:
                $ref: '#/components/schemas/Thumb'
            thumbsline_list_uhd:
              type: array
              items:
                $ref: '#/components/schemas/Thumb'
        share_link:
          type: string
          format: uri
        watermark:
          type: string
        watermark_clickable_enabled:
          type: boolean
        show_best_quality_link:
          type: boolean
        show_vod_recommendations:
          type: boolean
        cdn_id:
          type: integer
        external_source:
          type: boolean
        is_autoplay:
          type: boolean
        is_embed:
          type: boolean
        is_favorite:
          type: boolean
        is_live:
          type: boolean
        is_tv:
          type: boolean
        is_sport:
          type: boolean
        is_uhd:
          type: boolean
          description: '`true` for a 4K version. The key must have the 4K setting; then `bitrates` has
            only 2160.

            '
        is_uhd_8k:
          type: boolean
        is_hdr:
          type: boolean
          description: '`true` for an HDR version.

            '
        is_3d:
          type: boolean
    Thumb:
      type: object
      properties:
        id:
          type: integer
        url:
          type: string
          format: uri
    Bitrate:
      type: object
      properties:
        index:
          type: integer
        bitrate:
          type: integer
          description: 'The vertical resolution

            '
          for example 720.: null
        name:
          type: string
          description: 'Localized name, for example "High (720)".

            '
        src:
          type: string
          description: 'The manifest URL for this bitrate only. Empty if not available.

            '
        license_server:
          type:
          - string
          - 'null'
          description: 'The license URL for this `src`. With DRM, each bitrate has its own `src` and `license_server`.

            '
    AudioTrack:
      type: object
      properties:
        id:
          type: integer
          description: 'The ID of the language version. The same in all videos (for example 11 = Russian).

            '
        index:
          type: integer
          description: 'The value for the `/a/{index}/` segment of the stream URL (HLS

            version 3, MSS). It is not the order in the menu. Use the order

            of the `audio_tracks` array for the menu.

            '
        lang:
          type: string
          description: 'MEGOGO language code (`ua`, `ge`, `kz`...). Not ISO. Can repeat.

            '
        lang_iso_639_1:
          type: string
          description: 'ISO 639-1 code.

            '
        lang_tag:
          type: string
          description: 'The unique key of the track: `<ISO 639-1>-x-<id>`. The manifest

            uses the same value in `LANGUAGE` (HLS) or `lang` (DASH).

            '
          examples:
          - ru-x-11
        lang_original:
          type: string
        display_name:
          type: string
        is_active:
          type: boolean
          description: 'The default track: the first track with the requested `lang`. Start the playback
            with it. Find the track in the manifest by `lang_tag`.

            '
        require_subtitles:
          type: boolean
          description: 'The player must show subtitles with this track. The user cannot switch them off,
            but can select their language. Do not offer subtitles in the language of the track. If no
            other subtitles are available, do not show this track.

            '
        subtitles_policy:
          type: object
          properties:
            allowed_subtitles:
              type: array
              items:
                type: integer
              description: 'Subtitle IDs.

                '
            is_disableable:
              type: boolean
              description: 'The user can switch off the subtitles. `false` for a track with `require_subtitles:
                true`.

                '
            preselect:
              type: integer
              description: 'The `id` of the subtitles to switch on with this track when `is_disableable`
                is `false`. If `is_disableable` is `true`, ignore it.

                '
    Subtitle:
      type: object
      properties:
        id:
          type: integer
        index:
          type: integer
        type:
          type: string
          examples:
          - srt
        lang:
          type: string
        lang_iso_639_1:
          type: string
        lang_tag:
          type: string
        lang_original:
          type: string
        display_name:
          type: string
        url:
          type: string
          format: uri
