> ## 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.

# Connector TTS Stream with Style (v3)

> Streams speech for `text` in a voice picked by ID, as a WAV stream (header, then 16-bit PCM mono). Built for TTS connectors such as Genesys: the speaker and language come from the voice. Same as the v1 connector route, plus `dialect` and the style fields `emotion`, `casual`, `autoEmotion`, `mapFillers`, `useNativeEnglish` and `generationId`; there is no `expressiveness`.



## OpenAPI

````yaml /api-reference/openapi.json post /v3/realtime/connector/tts-stream
openapi: 3.0.1
info:
  title: Hamsa API
  description: >-
    The Hamsa API: voice agents and their calls, phone numbers, batch calls and
    knowledge bases; speech to text, text to speech, voices and AI content.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tryhamsa.com
security: []
paths:
  /v3/realtime/connector/tts-stream:
    post:
      summary: Stream speech with style for a TTS connector
      description: >-
        Streams speech for `text` in a voice picked by ID, as a WAV stream
        (header, then 16-bit PCM mono). Built for TTS connectors such as
        Genesys: the speaker and language come from the voice. Same as the v1
        connector route, plus `dialect` and the style fields `emotion`,
        `casual`, `autoEmotion`, `mapFillers`, `useNativeEnglish` and
        `generationId`; there is no `expressiveness`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RtConnectorTtsV3Request'
            examples:
              telephony:
                summary: Arabic, 8 kHz, calm
                value:
                  text: مرحبا، كيف يمكنني مساعدتك اليوم؟
                  voiceId: 078338c4-7788-4371-95d4-1bbe45021113
                  sampleRate: 8k
                  emotion: calm
                  autoEmotion: false
      responses:
        '200':
          description: WAV audio stream (chunked).
          content:
            audio/wav:
              schema:
                type: string
                format: binary
          headers:
            Transfer-Encoding:
              description: The audio is streamed.
              schema:
                type: string
                example: chunked
        '400':
          description: >-
            Invalid body, for example "The Emotion field's allowed values are:
            neutral, happy, ...!", or `sampleRate` sent with `mulaw: true`. The
            body is the message as plain text.
          content:
            text/plain:
              schema:
                type: string
        '401':
          description: Missing or invalid API key. The body is the message as plain text.
          content:
            text/plain:
              schema:
                type: string
        '402':
          description: Insufficient balance. The body is the message as plain text.
          content:
            text/plain:
              schema:
                type: string
        '403':
          description: >-
            The API key does not have the `realtime:create` scope, or the
            request origin is not allowed for this key. The body is the message
            as plain text.
          content:
            text/plain:
              schema:
                type: string
        '404':
          description: >-
            Voice not found or not available for this API key. The body is the
            message as plain text.
          content:
            text/plain:
              schema:
                type: string
        '422':
          description: >-
            A value the voice model can't use; `message` gives the reason. The
            body is the message as plain text.
          content:
            text/plain:
              schema:
                type: string
        '429':
          description: >-
            Too many requests: over 100 realtime requests a minute with this key
            ("Rate limit exceeded for this API key"), or too many requests from
            your IP address. Wait for the `Retry-After` seconds when it is sent,
            then retry.
        '500':
          description: Server Side Error. The body is the message as plain text.
          content:
            text/plain:
              schema:
                type: string
        '503':
          description: >-
            Service is busy: retry shortly. The body is the message as plain
            text.
          content:
            text/plain:
              schema:
                type: string
      security:
        - ApiKeyAuth: []
components:
  schemas:
    RtConnectorTtsV3Request:
      type: object
      required:
        - text
        - voiceId
      properties:
        text:
          type: string
          minLength: 1
          maxLength: 2000
          example: أهلاً، كيف بقدر أساعدك اليوم؟
          description: >-
            Text to speak, 1 to 2,000 characters. May contain `<pause_short>`
            and `<pause_long>`; a line break counts as a short pause. Numbers,
            dates and units are read out in words.
        voiceId:
          type: string
          format: uuid
          example: 078338c4-7788-4371-95d4-1bbe45021113
          description: >-
            ID of a voice from the voice catalog (`GET /v2/tts/voices/catalog`),
            or one of your cloned voices. The speaker and language come from the
            voice.
        sampleRate:
          type: string
          enum:
            - 8k
            - 16k
          default: 8k
          example: 8k
          description: 'Output sample rate: `8k` (8 kHz, telephony) or `16k` (16 kHz).'
        dialect:
          type: string
          nullable: true
          enum:
            - uae
            - ksa
            - kuw
            - qat
            - bah
            - oma
            - egy
            - jor
            - pls
            - leb
            - syr
            - irq
            - msa
            - eng
          example: pls
          description: >-
            Overrides the voice's dialect. Leave it out (or send `null`) for the
            voice's own dialect. `uae` Emirati, `ksa` Saudi, `kuw` Kuwaiti,
            `qat` Qatari, `bah` Bahraini, `oma` Omani, `egy` Egyptian, `jor`
            Jordanian, `pls` Palestinian, `leb` Lebanese, `syr` Syrian, `irq`
            Iraqi, `msa` Modern Standard Arabic, `eng` English.
        model:
          type: string
          enum:
            - default
            - hamsa-tts-en
          default: default
          description: >-
            `default`, or `hamsa-tts-en` for the English model. Any other value
            uses `default`.
        generationId:
          type: string
          nullable: true
          minLength: 1
          maxLength: 128
          example: reply-7f3a2c
          description: >-
            Send the same ID with every piece of one reply, so voice and tone
            stay continuous across them. Make a new one for each reply. 1 to 128
            characters.
        emotion:
          type: string
          nullable: true
          enum:
            - neutral
            - happy
            - excited
            - calm
            - sympathetic
            - sad
            - frustrated
            - angry
            - surprised
            - hesitant
            - tired
            - whispering
          example: happy
          description: >-
            Speaking style for this request: `neutral`, `happy`, `excited`,
            `calm`, `sympathetic`, `sad`, `frustrated`, `angry`, `surprised`,
            `hesitant`, `tired` or `whispering`. Leave it out (or send `null`)
            for `neutral`.
        casual:
          type: boolean
          nullable: true
          example: true
          description: >-
            Relaxed, spontaneous speech with natural hesitations. Leave it out
            (or send `null`) for `false`.
        autoEmotion:
          type: boolean
          nullable: true
          example: false
          description: >-
            Picks an emotion from the text (an apology sounds sympathetic,
            laughter happy) and turns `casual` off for that request. Set `false`
            so your `emotion` and `casual` are always used. Leave it out (or
            send `null`) for `true`.
        mapFillers:
          type: boolean
          nullable: true
          example: true
          description: >-
            Turns written fillers into real filler sounds (امم or "Hmm" is said
            as "umm"). Leave it out (or send `null`) for `true`.
        useNativeEnglish:
          type: boolean
          nullable: true
          example: false
          description: >-
            `false`: English words are said with the voice's Arabic accent.
            `true`: English parts get a native English pronunciation. Leave it
            out (or send `null`) for `false`.
  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.