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

# Generate a TTS audio preview

> Generate a TTS audio preview with custom text and voice config. Use to test how specific text sounds before committing changes to a voice's settings.



## OpenAPI

````yaml api-reference/agents/openapi.json POST /v1/agents/{agentId}/generate-audio
openapi: 3.1.0
info:
  title: PolyAI Agents API
  version: 1.0.11
  description: Manage PolyAI agents, telephony, deployments, and real-time configs.
servers:
  - url: https://api.us.poly.ai
    description: US region
  - url: https://api.eu.poly.ai
    description: EU region
  - url: https://api.uk.poly.ai
    description: UK region
  - url: https://api.studio.poly.ai
    description: Studio region
security:
  - polyApiKey: []
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: >-
        Generate a TTS audio preview with custom text and voice config. Use to
        test how specific text sounds before committing changes to a voice's
        settings.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateAudioRequest'
      responses:
        '200':
          description: Successful response
          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:
    GenerateAudioRequest:
      type: object
      title: GenerateAudioRequest
      description: >-
        Text, language, and provider-specific config for synthesizing a short
        audio sample.
      properties:
        provider:
          type:
            - string
            - 'null'
          default: eleven_labs
          description: TTS provider key, e.g. 'eleven_labs', 'cartesia'
        text:
          type: string
          description: Text to synthesize
        language:
          type: string
          description: BCP-47 language tag, e.g. 'en-US'
        config:
          type: object
          description: Provider-specific synthesis config
        storeOnS3:
          type:
            - boolean
            - 'null'
          description: Store audio on S3 and return a presigned URL
      required:
        - text
        - language
        - config
    GenerateAudioResponse:
      type: object
      title: GenerateAudioResponse
      description: A synthesized audio sample and the text it was generated from.
      properties:
        url:
          type: string
          description: URL of the generated audio
        text:
          type: string
          description: Text that was synthesized
      required:
        - url
        - text
  securitySchemes:
    polyApiKey:
      type: apiKey
      in: header
      name: X-API-KEY

````