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

# Generate Text to Speech File Data



## OpenAPI

````yaml POST /v1/realtime/tts
openapi: 3.0.1
info:
  title: Hamsa API
  description: Trying out our transcription and media-to-text APIs
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tryhamsa.com
security: []
paths:
  /v1/realtime/tts:
    post:
      summary: Generates an audio file from a text string (not streamed).
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RtTtsRequest'
      responses:
        '200':
          description: Successful response
          content:
            audio/wav:
              schema:
                type: string
                format: binary
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '500':
          description: Server Side Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    RtTtsRequest:
      type: object
      properties:
        text:
          type: string
          description: The text to be generated as an aduio file.
          example: مرحباً بكم في جميعاً في همسة!
        speaker:
          type: string
          description: >-
            The speaker name, Suggestions: Amjad, Lyali, Salma, Mariam, Dalal,
            Lana, Jasem, Samir, Carla, Nada, or you can provide another values
            from the voice agents dashboard. You can also provide your own
            cloned voice's id here in the speaker field, but you need to preload
            that voice into the system first from
            [here](/api-reference/endpoint/preload-cloned-tts-voice)
          example: Majd
        dialect:
          type: string
          enum:
            - pls
            - egy
            - syr
            - irq
            - jor
            - leb
            - ksa
            - uae
            - bah
            - qat
            - msa
          description: >-
            The dialect of each country by its country code. Recommended voices
            per dialect are: pls (Palestinian): Amjad, Layan, Talin, Rema, Ali;
            leb (Lebanese): Carla, Majd; jor (Jordanian): Lana, Jasem, Nada,
            Sarah; syr (Syrian): Dalal, Mais; ksa (Saudi): Hiba, Khadija, Fahd,
            Jasem; bah (Bahraini): Mazen, Ruba; uae (Emirati): Salma, Dima; egy
            (Egyptian): Mariam, Samir, Nada, Ali, Ahmed; irq (Iraqi): Lyali,
            Fatma.
          example: pls
        mulaw:
          type: boolean
          description: Whether to use 'Mu-Law' algorithm in voice signal processing or not.
          example: false
          default: false
      required:
        - text
        - speaker
    ErrorSchema:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Pass the API key in the Authorization header, You need to put Token
        keyword before the API key. e.g. 'Authorization: Token <api-key>'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.