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

# Text to Speech

> Converts text to speech using specified voice and parameters



## OpenAPI

````yaml openapi-tts POST /v1/tts
openapi: 3.0.1
info:
  title: Puretalk AI
  description: Api Documentation for Puretalk AI
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.puretalk.ai/api
security:
  - ApiKeyAuth: []
paths:
  /v1/tts:
    post:
      description: Converts text to speech using specified voice and parameters
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - voice_id
                - text
              properties:
                voice_id:
                  type: string
                  format: uuid
                  example: 5bc2961c-fb9b-4a3d-a257-e0c5f2f95332
                  description: >-
                    The voice ID to use for text-to-speech conversion. See the
                    available voices documentation 👉 [GET
                    /voices/get-voices](/api-reference/voices/get-voices)
                text:
                  type: string
                  example: Hey there! Welcome to Los Angeles
                  description: The text to convert to speech
                output_format:
                  type: string
                  enum:
                    - raw
                    - wav
                    - mp3
                  default: raw
                encoding:
                  type: string
                  enum:
                    - pcm_f32le
                    - pcm_s16le
                    - mulaw
                    - alaw
                    - mp3
                  default: pcm_f32le
                sample_rate:
                  type: integer
                  minimum: 8000
                  default: 16000
                  maximum: 48000
                  description: >-
                    The sample rate of the audio file in Hertz (Hz). This
                    determines the number of samples of audio carried per
                    second. The minimum value is 8000 Hz, which is typically
                    used for telephony. The default value is 16000 Hz, which
                    provides a good balance between quality and file size. The
                    maximum value is 48000 Hz, which is used for high-quality
                    audio recordings.
                language:
                  type: string
                  enum:
                    - en
                    - fr
                    - de
                    - es
                    - pt
                    - zh
                    - ja
                    - hi
                    - it
                    - ko
                    - nl
                    - pl
                    - ru
                    - sv
                    - tr
                  default: en
                voice_speed:
                  type: number
                  minimum: -1
                  maximum: 1
                  default: 0
                  description: >-
                    Adjusts the speed of the voice. Acceptable values range from
                    -1 (slowest) to 1 (fastest), with 0 being the default normal
                    speed.
                voice_emotion:
                  type: array
                  items:
                    type: string
                    enum:
                      - anger:lowest
                      - anger:low
                      - anger
                      - anger:high
                      - anger:highest
                      - positivity:lowest
                      - positivity:low
                      - positivity
                      - positivity:high
                      - positivity:highest
                      - surprise:lowest
                      - surprise:low
                      - surprise
                      - surprise:high
                      - surprise:highest
                      - sadness:lowest
                      - sadness:low
                      - sadness
                      - sadness:high
                      - sadness:highest
                      - curiosity:lowest
                      - curiosity:low
                      - curiosity
                      - curiosity:high
                      - curiosity:highest
                  default: []
                  description: >-
                    Array of voice emotions to apply. Acceptable values include
                    various levels of anger, positivity, surprise, sadness, and
                    curiosity.
      responses:
        '200':
          description: Audio file generated successfully
          content:
            audio/wav:
              schema:
                type: string
                format: binary
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      required:
        - err
        - msg
      type: object
      properties:
        err:
          type: boolean
        msg:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        Authorization header containing API key. You can find your API key in
        the dashboard under 'API Keys'.

````