> ## Documentation Index
> Fetch the complete documentation index at: https://docs.topmediai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Text To Speech

> Converts text into speech using a voice of your choice and returns audio.



## OpenAPI

````yaml https://api.topmediai.com/topmediai_api.json post /v1/text2speech
openapi: 3.1.0
info:
  title: Topmediai API Documentation
  description: >-
    This is the documentation for the Topmediai API. You can use this API to use
    our service programmatically, this is done by using your x-api-key. You can
    get your x-api-key by request our Get API Key Web page on
    https://www.topmediai.com/api/text-to-speech-api/. Our API is experimental
    so all endpoints are subject to change.
  version: 1.0.0
servers:
  - url: https://api.topmediai.com
security: []
paths:
  /v1/text2speech:
    post:
      tags:
        - Text-to-Speech
      summary: Text To Speech
      description: >-
        Converts text into speech using a voice of your choice and returns
        audio.
      operationId: text_to_speech_v1_text2speech_post
      parameters:
        - name: x-api-key
          in: header
          required: false
          schema:
            type: string
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TTSBodySchemas'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    TTSBodySchemas:
      properties:
        text:
          type: string
          maxLength: 500
          minLength: 1
          title: Text
          example: Welcome to our API
        speaker:
          type: string
          title: Speaker
          example: 00151554-3826-11ee-a861-00163e2ac61b
        emotion:
          anyOf:
            - type: string
            - type: 'null'
          title: Emotion
          description: >-
            some voice have emotion: Angry, Cheerful, Sad, Excited, Friendly,
            Terrified, Shouting, Unfriendly, Whispering, Hopeful, Soulful,
            Pleasant, Complaining, Surprised, Uneasy, Fearful, Disgust
          example: Neutral
          exclude_unset: true
      type: object
      required:
        - text
        - speaker
      title: TTSBodySchemas
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````