openapi: 3.0.1
info:
  title: TTS API
  version: v1
servers:
- url: https://api.cm.com
paths:
  /voice-tts/v1/voices:
    get:
      tags:
      - Voices
      summary: Get TTS Voices
      description: Get a list of available TTS voices supported by the Voice applications.
      parameters:
      - name: IsPremium
        in: query
        description: "Whether only premium or non-premium voices should be returned. If left empty, both premium and non premium voices\r\nwill be returned."
        schema:
          type: boolean
          example: true
        example: true
      - name: Language
        in: query
        description: "ISO-639 language code and ISO-3166 country code combination to filter the voices on. It's also possible to only\r\nfilter on languages independent of countries by only supplying the ISO-639 code (e.g. `en`)."
        schema:
          type: string
          example: en-US
        example: en-US
      - name: Gender
        in: query
        description: Gender to filter on.
        schema:
          $ref: '#/components/schemas/ApiGender'
        example: Female
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ApiTtsVoice'
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ApiTtsVoice'
            text/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ApiTtsVoice'
  /voice-tts/v1/voices/preview:
    post:
      tags:
      - Voices
      summary: Get TTS Voice preview
      description: Returns a preview of the given TTS voice.
      requestBody:
        description: The voice to preview
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiTtsPreviewRequest'
          text/json:
            schema:
              $ref: '#/components/schemas/ApiTtsPreviewRequest'
          application/*+json:
            schema:
              $ref: '#/components/schemas/ApiTtsPreviewRequest'
      responses:
        '200':
          description: TTS preview file.
components:
  schemas:
    ApiGender:
      title: Gender
      enum:
      - Male
      - Female
      type: string
      description: Available genders for TTS voices.
    ApiTtsPreviewRequest:
      required:
      - gender
      - isPremium
      - language
      - voiceNumber
      type: object
      properties:
        language:
          minLength: 1
          pattern: ^[a-zA-Z]{2}-[a-zA-Z]{2}$
          type: string
          description: ISO-639 language code and ISO-3166 country code.
          example: en-GB
        gender:
          $ref: '#/components/schemas/ApiGender'
        voiceNumber:
          minimum: 0
          exclusiveMinimum: true
          type: integer
          description: The voice number, used to identify this voice.
          format: int32
          example: 2
        isPremium:
          type: boolean
          description: Whether or not this is a premium TTS voice.
          example: true
        encoding:
          $ref: '#/components/schemas/Encoding'
      additionalProperties: false
      description: Model describing a TTS voice to fetch the preview audio file for.
    ApiTtsVoice:
      title: Tts Voice
      type: object
      properties:
        language:
          type: string
          description: ISO-639 language code and ISO-3166 country code.
          nullable: true
          example: en-GB
        gender:
          $ref: '#/components/schemas/ApiGender'
        voiceNumber:
          type: integer
          description: The voice number, used to indentify this voice.
          format: int32
          example: 2
        name:
          type: string
          description: The display name of the current TTS voice.
          nullable: true
          example: Amy
        isPremium:
          type: boolean
          description: Whether or not this is a premium TTS voice, meaning extra surcharges will be invoices for it's use.
          example: true
      additionalProperties: false
      description: Model describing a TTS voice that's supported by the Voice TTS server.
    Encoding:
      title: Encoding
      enum:
      - Mp3
      - Ogg
      - Pcm
      type: string
      description: The encoding of the audio.
  securitySchemes:
    X-CM-PRODUCTTOKEN:
      type: apiKey
      description: Your producttoken
      name: X-CM-PRODUCTTOKEN
      in: header
security:
- X-CM-PRODUCTTOKEN: []
x-readme:
  explorer-enabled: true
  proxy-enabled: true
