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

# Generate a TTS audio preview

> Synthesize a short audio preview for a given voice, language, and text. Use this to audition a voice or to test tuning settings before applying them to the live agent.



## OpenAPI

````yaml POST /v1/agents/{agentId}/generate-audio
openapi: 3.1.0
info:
  title: PolyAI Agents API
  version: 1.0.4
  description: >-
    Build and deploy PolyAI agents programmatically. Create agents, manage
    branches, update behavior rules, configure knowledge bases, provision
    telephony, configure voices, publish deployments, and update real-time
    configs.
servers:
  - url: https://api.us.poly.ai
    description: US region
  - url: https://api.uk.poly.ai
    description: UK region
  - url: https://api.eu.poly.ai
    description: EU region
security:
  - ApiKeyAuth: []
tags:
  - name: Agents
    description: Create, list, duplicate, and delete agents.
  - name: Branches
    description: Create isolated branches for parallel development and merge back to main.
  - name: Agent Behavior
    description: >-
      Read and update an agent's behavior rules (system prompt, interaction
      style, edge cases).
  - name: Knowledge Base
    description: Manage knowledge base topics used for retrieval and tool invocation.
  - name: Variants
    description: Manage site-specific variations of an agent using attributes and variants.
  - name: Deployments
    description: Publish drafts, promote across environments, and roll back deployments.
  - name: Connectors
    description: >-
      Manage telephony connectors that bind phone numbers to voice
      infrastructure.
  - name: Phone Numbers
    description: Provision, reassign, and delete phone numbers on an agent's connectors.
  - name: Real-Time Configs
    description: Update runtime values (e.g. opening hours) outside the publish workflow.
  - name: Voices
    description: >-
      Configure agent voices: pick the active voice, run multi-voice rotations,
      tune stability and speed, and generate audio previews.
paths:
  /v1/agents/{agentId}/generate-audio:
    parameters:
      - name: agentId
        in: path
        required: true
        schema:
          type: string
    post:
      tags:
        - Voices
      summary: Generate a TTS audio preview
      description: >-
        Synthesize a short audio preview for a given voice, language, and text.
        Use this to audition a voice or to test tuning settings before applying
        them to the live agent.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateAudioBody'
      responses:
        '200':
          description: URL to the generated audio
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateAudioResponse'
        '400':
          description: Validation error
        '401':
          description: Unauthorized – missing or invalid API key
        '403':
          description: Forbidden – insufficient permissions
components:
  schemas:
    GenerateAudioBody:
      description: >-
        Synthesize a short audio preview for a given voice and text. Useful for
        auditioning a voice or tuning settings before deploying.
      type: object
      properties:
        provider:
          description: >-
            TTS provider key (e.g. `eleven_labs`, `cartesia`). Defaults to
            `eleven_labs`.
          type: string
        text:
          description: Text to synthesize
          type: string
        language:
          description: BCP-47 language tag, e.g. `en-US`
          type: string
        config:
          description: >-
            Provider-specific synthesis config. Typically includes the voice ID
            and any tuning overrides accepted by the provider.
          type: object
        storeOnS3:
          description: >-
            When true, store the audio in S3 and return a presigned URL. When
            false or omitted, returns a short-lived URL only.
          type: boolean
      required:
        - text
        - language
        - config
      additionalProperties: false
      title: GenerateAudioBody
    GenerateAudioResponse:
      description: Generated audio preview.
      type: object
      properties:
        url:
          description: URL of the generated audio file
          type: string
        text:
          description: The text that was synthesized
          type: string
      required:
        - url
        - text
      additionalProperties: false
      title: GenerateAudioResponse
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````