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

# Generate Text to Speech File Data



## OpenAPI

````yaml /api-reference/openapi.json 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 (voice) name. Pick a voice that matches the chosen
            dialect — see the `dialect` field for voice examples per dialect.
            You can also pass the UUID of a custom cloned voice, but you must
            first preload it via the [Preload Cloned Voice
            endpoint](/src/api-reference/endpoint/preload-cloned-tts-voice).
          example: Amjad
        dialect:
          type: string
          enum:
            - pls
            - egy
            - syr
            - irq
            - jor
            - leb
            - ksa
            - uae
            - bah
            - qat
            - kuw
            - oma
            - msa
            - ar-sa
            - en
          description: >-
            The dialect to synthesize, identified by its country/region code.
            Voice examples per dialect:


            - `pls` (Palestinian) — Amjad, Layan

            - `egy` (Egyptian) — Mariam, Samir

            - `syr` (Syrian) — Dalal, Mais

            - `irq` (Iraqi) — Lyali, Fatma

            - `jor` (Jordanian) — Lana, Jasem

            - `leb` (Lebanese) — Carla, Majd

            - `ksa` (Saudi) — Hiba, Fahd

            - `uae` (Emirati) — Salma, Dima

            - `bah` (Bahraini) — Mazen, Ruba

            - `qat` (Qatari) — Deema, Faisal

            - `kuw` (Kuwaiti) — Mai, Hatem

            - `oma` (Omani) — Aisha, Jaber

            - `msa` (Modern Standard Arabic / Fusha) — Salem, Tamim

            - `ar-sa` (Arabic – Gulf) — Khalid, Rahma

            - `en` (English) — Emma, James
          example: pls
        mulaw:
          type: boolean
          description: Whether to use 'Mu-Law' algorithm in voice signal processing or not.
          example: false
          default: false
        expressiveness:
          type: number
          description: >-
            Controls how expressive the generated speech sounds. `0` is flat and
            monotone, `1` is the natural default, and `2` is highly expressive.
          minimum: 0
          maximum: 2
          default: 1
          example: 1
      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>'

````