openapi: 3.0.3
info:
  title: Video Config API
  description: |
    Use the Video Config API to manage per-video player configurations. Per-video configurations let you set player options for a specific video asset. See the [managing video settings via the API](https://cloudinary.com/documentation/video_player_how_to_embed#managing_video_settings_via_the_api) guide for details.

      The API supports Basic Authentication using your Cloudinary API Key and API Secret (which can be found in the API Keys page of your [Cloudinary Console](https://console.cloudinary.com/app/settings/api-keys)).

  version: 1.0.0
  contact:
    name: Cloudinary Support
    email: support@cloudinary.com
    url: https://support.cloudinary.com
  termsOfService: https://cloudinary.com/tou
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  x-cld-module-context: cloud
  x-cld-module-name: video-config
servers:
  - url: https://api.cloudinary.com/v2/video/{cloudName}
    variables:
      cloudName:
        default: CLOUD_NAME
        description: The cloud name for your product environment.
security:
  - basicAuth: []
tags:
  - name: Video Config
    description: Video Config endpoint
paths:
  /player/config/video/{videoAssetId}:
    parameters:
      - in: path
        name: videoAssetId
        schema:
          type: string
        required: true
        description: The asset ID of the video
    get:
      tags:
        - Video Config
      summary: 'Get video config'
      operationId: getVideoConfig
      responses:
        '200':
          description: The video config for the specified video
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoConfigWrappedResponse'
              example:
                request_id: 6ec0bd7f11c043da975e2a8ad9ebae0b
                data:
                  playerOptions:
                    controls: true
                    loop: true
                    colors:
                      base: '#1532a8'
                      accent: '#FF9B00'
                      text: '#FFFFFF'
                  sourceOptions:
                    sourceTypes:
                      - hls
        '400':
          description: Bad request - invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'
        '401':
          description: Authentication error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'
        '403':
          description: Authorization error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'
        '404':
          description: Video metadata not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'
    put:
      tags:
        - Video Config
      summary: 'Create or replace video player config for a specific video'
      operationId: putVideoPlayerConfig
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VideoPlayerConfigUpsertPayload'
            example:
              playerOptions:
                controls: true
                loop: true
                autoplay: on-scroll
                colors:
                  base: '#1532a8'
                  accent: '#FF9B00'
                  text: '#FFFFFF'
              sourceOptions:
                sourceTypes:
                  - hls
      responses:
        '200':
          description: A player config
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoConfigWrappedResponse'
              example:
                request_id: 6ec0bd7f11c043da975e2a8ad9ebae0b
                data:
                  playerOptions:
                    controls: true
                    loop: true
                    autoplay: on-scroll
                    colors:
                      base: '#1532a8'
                      accent: '#FF9B00'
                      text: '#FFFFFF'
                  sourceOptions:
                    sourceTypes:
                      - hls
        '400':
          description: Bad request - invalid request body
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'
        '401':
          description: Authentication error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'
        '403':
          description: Authorization error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'
        '404':
          description: Video player config not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  schemas:
    ErrorWrappedResponse:
      required:
        - request_id
        - data
      properties:
        request_id:
          type: string
          example: '6ec0bd7f11c043da975e2a8ad9ebae0b'
        error:
          type: object
          properties:
            message:
              type: string

    VideoPlayerConfigResponse:
      type: object
      required:
        - playerOptions
        - sourceOptions
      properties:
        playerOptions:
          type: object
          additionalProperties: {}
        sourceOptions:
          type: object
          additionalProperties: {}

    VideoPlayerConfigPayload:
      type: object
      properties:
        playerOptions:
          type: object
          additionalProperties: {}
        sourceOptions:
          type: object
          additionalProperties: {}

    VideoConfigWrappedResponse:
      type: object
      required:
        - request_id
        - data
      properties:
        request_id:
          type: string
          example: '6ec0bd7f11c043da975e2a8ad9ebae0b'
        data:
          $ref: '#/components/schemas/VideoPlayerConfigResponse'

    VideoPlayerConfigUpsertPayload:
      $ref: '#/components/schemas/VideoPlayerConfigPayload'
