openapi: 3.0.3
info:
  title: Video Player Profiles API
  description: |
    Use the Video Player Profiles API to manage reusable video player configurations (profiles). Profiles allow you to define a set of player and source options once and apply them across multiple video player instances. See the [player profiles guide](https://cloudinary.com/documentation/video_player_how_to_embed#player_profiles) for information on how to use profiles with the Cloudinary Video Player.

      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-player-profiles
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 Player Profile
    description: Video Player Profile endpoint
paths:
  /player/profiles:
    get:
      tags:
        - Video Player Profile
      summary: 'Get a list of player profiles'
      operationId: getVideoPlayerProfiles
      responses:
        '200':
          description: A list of player profiles
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoPlayerProfilesWrappedResponse'
              example:
                request_id: 2f9754330d613b998bb572696869b1ed
                data:
                - name: my_profile
                - name: my_other_profile
        '401':
          description: Authentication error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'
        '403':
          description: Authorization error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'

  /player/profiles/{profileName}:
    parameters:
      - in: path
        name: profileName
        schema:
          type: string
        required: true
        description: player profile name
    get:
      tags:
        - Video Player Profile
      summary: 'Get a single player profile'
      operationId: getVideoPlayerProfile
      responses:
        '200':
          description: A player profile
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoPlayerProfileWrappedResponse'
              example:
                request_id: 6ec0bd7f11c043da975e2a8ad9ebae0b
                data:
                  name: my_profile
                  is_system_profile: false
                  created_at: 1700000000
                  updated_at: 1700000000
                  contents:
                    playerOptions: {}
                    sourceOptions: {}
        '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: Player profile not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'
    put:
      tags:
        - Video Player Profile
      summary: 'Create or replace a player profile'
      operationId: putVideoPlayerProfile
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VideoPlayerProfileUpsertPayload'
      responses:
        '200':
          description: A player profile
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VideoPlayerProfileWrappedResponse'
              example:
                request_id: 6ec0bd7f11c043da975e2a8ad9ebae0b
                data:
                  name: my_profile
                  is_system_profile: false
                  created_at: 1700000000
                  updated_at: 1700000000
                  contents:
                    playerOptions: {}
                    sourceOptions: {}
        '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: Player profile not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'
    delete:
      tags:
        - Video Player Profile
      summary: 'Delete a player profile'
      operationId: deleteVideoPlayerProfile
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageWrappedResponse'
        '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: Player profile not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorWrappedResponse'
components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
  schemas:
    MessageWrappedResponse:
      required:
        - request_id
        - data
      properties:
        request_id:
          type: string
          example: '6ec0bd7f11c043da975e2a8ad9ebae0b'
        data:
          type: object
          properties:
            message:
              type: string

    ErrorWrappedResponse:
      required:
        - request_id
        - data
      properties:
        request_id:
          type: string
          example: '6ec0bd7f11c043da975e2a8ad9ebae0b'
        error:
          type: object
          properties:
            message:
              type: string

    VideoPlayerProfilesResponse:
      type: object
      required:
        - is_system_profile
      properties:
        name:
          type: string
        is_system_profile:
          type: boolean

    VideoPlayerProfileDetailsResponse:
      type: object
      required:
        - is_system_profile
      properties:
        id:
          type: string
        name:
          type: string
        created_at:
          type: integer
          format: int64
        updated_at:
          type: integer
          format: int64
        is_system_profile:
          type: boolean
        contents:
          $ref: '#/components/schemas/VideoPlayerConfigResponse'

    VideoPlayerProfilesWrappedResponse:
      type: object
      required:
        - request_id
        - data
      properties:
        request_id:
          type: string
          example: '6ec0bd7f11c043da975e2a8ad9ebae0b'
        data:
          type: array
          items:
            $ref: '#/components/schemas/VideoPlayerProfilesResponse'

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

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

    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: {}
