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

> 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, language and dialect come from the voice. Use voice IDs from `GET /v2/tts/voices/catalog`.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/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:
  /v1/realtime/connector/tts-stream:
    post:
      summary: Stream speech 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, language and dialect come from the voice. Use
        voice IDs from `GET /v2/tts/voices/catalog`.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - text
                - voiceId
              properties:
                text:
                  type: string
                  minLength: 1
                  maxLength: 2000
                  description: Text to speak, 1-2,000 characters.
                  example: مرحبا، كيف يمكنني مساعدتك اليوم؟
                voiceId:
                  type: string
                  format: uuid
                  description: >-
                    ID of a voice from the voice catalog, or one of your cloned
                    voices.
                  example: 078338c4-7788-4371-95d4-1bbe45021113
                sampleRate:
                  type: string
                  enum:
                    - 8k
                    - 16k
                  default: 8k
                  example: 8k
                  description: >-
                    Output sample rate: `8k` (8 kHz, telephony) or `16k` (16
                    kHz).
                expressiveness:
                  type: number
                  minimum: 0
                  maximum: 2
                  default: 1
                  description: >-
                    **Deprecated.** Still accepted (0 to 2, default 1) so
                    existing requests keep working; don't build on it. For
                    emotion and casual delivery, use the [v3 connector
                    route](/api-reference/endpoint/connector-tts-stream-v3) and
                    its `emotion` and `casual` fields.
                  example: 1
                  deprecated: true
                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`.
            examples:
              telephony:
                summary: Arabic, 8 kHz
                value:
                  text: مرحبا، كيف يمكنني مساعدتك اليوم؟
                  voiceId: 078338c4-7788-4371-95d4-1bbe45021113
                  sampleRate: 8k
              wideband:
                summary: English, 16 kHz
                value:
                  text: Hello, how can I help you today?
                  voiceId: bf1f8b18-bb5d-40b6-a46b-89274ea800a2
                  sampleRate: 16k
      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.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '401':
          description: 'Unauthorized: missing or invalid API key.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '402':
          description: Insufficient balance.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '403':
          description: >-
            The API key does not have the `realtime:create` scope, or the
            request origin is not allowed for this key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '404':
          description: Voice not found or not available for this API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '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
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '503':
          description: 'Service is busy: retry shortly.'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ErrorSchema:
      type: object
      properties:
        code:
          type: integer
          description: >-
            Service error code: the HTTP status with a service prefix (for
            example `8404`). Missing when the service has no code for that
            status.
          example: 8404
        message:
          type: string
          description: >-
            What went wrong. Some services (calls and recordings) put the error
            key here, for example `CallNotFoundOrUnavailable`, and send no
            `messageKey`.
          example: Policy not found!
        messageKey:
          type: string
          description: >-
            Stable key for the error, safe to match on in code. Not returned by
            every service.
          example: PolicyNotFound
        params:
          type: object
          additionalProperties: true
          description: >-
            Details for some errors (for example `reason`). Not returned by
            every service.
          example:
            reason: NO_DRAFT
  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.