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

# Create a voice clone from an audio file upload

> Creates a new voice clone by uploading an audio file directly. Supported formats: WAV, MP3, FLAC, OGG, M4A. For best results, provide 5–10 seconds of clear speech. Maximum file size: 5MB for Telnyx, 20MB for Minimax.



## OpenAPI

````yaml /openapi/generated/text-to-speech/voice-designs.yml post /voice_clones/from_upload
openapi: 3.1.0
info:
  contact:
    email: support@telnyx.com
  description: >-
    Design AI-generated voices using natural language prompts, manage voice
    versions, and capture voice identities as clones for use in text-to-speech
    synthesis.
  title: Voice Designs and Voice Clones API
  version: 2.0.0
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
tags:
  - description: >-
      Create and manage AI-generated voice designs using natural language
      prompts.
    name: Voice Designs
  - description: >-
      Capture and manage voice identities as clones for use in text-to-speech
      synthesis.
    name: Voice Clones
paths:
  /voice_clones/from_upload:
    post:
      tags:
        - Voice Clones
      summary: Create a voice clone from an audio file upload
      description: >-
        Creates a new voice clone by uploading an audio file directly. Supported
        formats: WAV, MP3, FLAC, OGG, M4A. For best results, provide 5–10
        seconds of clear speech. Maximum file size: 5MB for Telnyx, 20MB for
        Minimax.
      operationId: createVoiceCloneFromUpload
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/VoiceCloneUploadRequest'
      responses:
        '201':
          description: Voice clone created successfully from the uploaded audio.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VoiceCloneResponse'
        '202':
          description: >-
            Voice clone accepted — on-prem import in progress (Ultra model).
            Poll GET /voice_clones/{id} to check status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VoiceCloneResponse'
        '400':
          description: >-
            Bad request — the audio file is invalid, unsupported, or exceeds the
            size limit.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/voice-designs_ErrorResponse'
        '401':
          description: Unauthorized — missing or invalid bearer token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/voice-designs_ErrorResponse'
        '422':
          description: Unprocessable entity — validation error in the request body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/voice-designs_ErrorResponse'
        '502':
          description: Bad gateway — upstream voice cloning service is unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/voice-designs_ErrorResponse'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Telnyx from 'telnyx';

            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });

            const response = await client.voiceClones.createFromUpload({
              params: {
                audio_file: fs.createReadStream('path/to/file'),
                gender: 'male',
                language: 'lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf',
                name: 'name',
                provider: 'telnyx',
              },
            });

            console.log(response.data);
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            response = client.voice_clones.create_from_upload(
                params={
                    "audio_file": b"Example data",
                    "gender": "male",
                    "language": "lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf",
                    "name": "name",
                    "provider": "telnyx",
                },
            )
            print(response.data)
        - lang: Go
          source: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.VoiceClones.NewFromUpload(context.TODO(), telnyx.VoiceCloneNewFromUploadParams{\n\t\tOfTelnyxQwen3TtsClone: &telnyx.VoiceCloneNewFromUploadParamsParamsTelnyxQwen3TtsClone{\n\t\t\tAudioFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\t\tGender:    \"male\",\n\t\t\tLanguage:  \"lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf\",\n\t\t\tName:      \"name\",\n\t\t\tProvider:  \"telnyx\",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n"
        - lang: Java
          source: >-
            package com.telnyx.sdk.example;


            import com.telnyx.sdk.client.TelnyxClient;

            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            import
            com.telnyx.sdk.models.voiceclones.VoiceCloneCreateFromUploadParams;

            import
            com.telnyx.sdk.models.voiceclones.VoiceCloneCreateFromUploadResponse;

            import java.io.ByteArrayInputStream;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    VoiceCloneCreateFromUploadParams.Params.TelnyxQwen3TtsClone params = VoiceCloneCreateFromUploadParams.Params.TelnyxQwen3TtsClone.builder()
                        .audioFile(new ByteArrayInputStream("Example data".getBytes()))
                        .gender(VoiceCloneCreateFromUploadParams.Params.TelnyxQwen3TtsClone.Gender.MALE)
                        .language("lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf")
                        .name("name")
                        .provider(VoiceCloneCreateFromUploadParams.Params.TelnyxQwen3TtsClone.Provider.TELNYX)
                        .build();
                    VoiceCloneCreateFromUploadResponse response = client.voiceClones().createFromUpload(params);
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            response = telnyx.voice_clones.create_from_upload(
              params: {
                audio_file: StringIO.new("Example data"),
                gender: :male,
                language: "lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf",
                name: "name",
                provider: :telnyx
              }
            )

            puts(response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\FileParam;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $response = $client->voiceClones->createFromUpload(
                params: [
                  'audioFile' => FileParam::fromString('Example data', filename: uniqid('file-upload-', true)),
                  'gender' => 'male',
                  'language' => 'lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf',
                  'name' => 'name',
                  'provider' => 'telnyx',
                  'label' => 'label',
                  'modelID' => 'Qwen3TTS',
                  'refText' => 'ref_text',
                ],
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx voice-clones create-from-upload \
              --api-key 'My API Key' \
              --params '{audio_file: Example data, gender: male, language: lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf, name: name, provider: telnyx}'
components:
  schemas:
    VoiceCloneUploadRequest:
      description: >-
        Multipart form data for creating a voice clone from a direct audio
        upload. Maximum file size: 5MB for Telnyx, 20MB for Minimax.
      oneOf:
        - $ref: '#/components/schemas/TelnyxQwen3TTSClone'
        - $ref: '#/components/schemas/TelnyxUltraClone'
        - $ref: '#/components/schemas/MinimaxClone'
    VoiceCloneResponse:
      type: object
      description: Response envelope for a single voice clone.
      properties:
        data:
          $ref: '#/components/schemas/VoiceCloneData'
      example:
        data:
          record_type: voice_clone
          id: 660f9511-f3ac-52e5-b827-557766551111
          source_voice_design_id: 550e8400-e29b-41d4-a716-446655440000
          source_voice_design_version: 1
          name: clone-narrator
          language: en
          gender: male
          label: Speak in a warm, friendly tone
          created_at: '2024-01-01T00:00:00Z'
          updated_at: '2024-01-01T00:00:00Z'
          provider: Telnyx
          provider_supported_models:
            - Qwen3TTS
          provider_voice_id: 660f9511-f3ac-52e5-b827-557766551111
          model_id: Qwen3TTS
          status: active
    voice-designs_ErrorResponse:
      type: object
      description: Standard error response envelope.
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/voice-designs_ErrorObject'
      example:
        errors:
          - code: '10005'
            title: Resource not found
            detail: Voice design not found
    TelnyxQwen3TTSClone:
      type: object
      description: Upload-based voice clone using the Telnyx Qwen3TTS model (default).
      required:
        - audio_file
        - name
        - language
        - gender
        - provider
      properties:
        audio_file:
          type: string
          format: binary
          description: >-
            Audio file to clone the voice from. Supported formats: WAV, MP3,
            FLAC, OGG, M4A. For best quality, provide 5–10 seconds of clear,
            uninterrupted speech. Maximum size: 5MB.
        name:
          type: string
          maxLength: 255
          description: Name for the voice clone.
        language:
          type: string
          pattern: ^([Aa]uto|[a-z]{2,3}(-[A-Za-z0-9]{2,8})*)$
          description: ISO 639-1 language code from the Qwen language set.
        gender:
          type: string
          enum:
            - male
            - female
            - neutral
          description: Gender of the voice clone.
        ref_text:
          type: string
          description: >-
            Optional transcript of the audio file. Providing this improves clone
            quality.
        label:
          type: string
          description: Optional custom label describing the voice style.
        model_id:
          type:
            - string
            - 'null'
          enum:
            - Qwen3TTS
            - null
          description: TTS model identifier. Nullable/omittable — defaults to Qwen3TTS.
        provider:
          type: string
          enum:
            - telnyx
            - Telnyx
          description: Voice synthesis provider. Must be `telnyx`.
    TelnyxUltraClone:
      type: object
      description: Upload-based voice clone using the Telnyx Ultra model.
      required:
        - audio_file
        - name
        - language
        - gender
        - model_id
        - provider
      properties:
        audio_file:
          type: string
          format: binary
          description: >-
            Audio file to clone the voice from. Supported formats: WAV, MP3,
            FLAC, OGG, M4A. For best quality, provide 5–10 seconds of clear,
            uninterrupted speech. Maximum size: 5MB.
        name:
          type: string
          maxLength: 255
          description: Name for the voice clone.
        language:
          type: string
          pattern: ^([Aa]uto|[a-z]{2,3}(-[A-Za-z0-9]{2,8})*)$
          description: ISO 639-1 language code from the Ultra language set (40 languages).
        gender:
          type: string
          enum:
            - male
            - female
            - neutral
          description: Gender of the voice clone.
        ref_text:
          type: string
          description: >-
            Optional transcript of the audio file. Providing this improves clone
            quality.
        label:
          type: string
          description: Optional custom label describing the voice style.
        model_id:
          type: string
          enum:
            - Ultra
          description: TTS model identifier. Must be `Ultra`.
        provider:
          type: string
          enum:
            - telnyx
            - Telnyx
          description: Voice synthesis provider. Must be `telnyx`.
    MinimaxClone:
      type: object
      description: Upload-based voice clone using the Minimax provider.
      required:
        - audio_file
        - name
        - language
        - gender
        - provider
      properties:
        audio_file:
          type: string
          format: binary
          description: >-
            Audio file to clone the voice from. Supported formats: WAV, MP3,
            FLAC, OGG, M4A. For best quality, provide 5–10 seconds of clear,
            uninterrupted speech. Maximum size: 20MB.
        name:
          type: string
          maxLength: 255
          description: Name for the voice clone.
        language:
          type: string
          pattern: ^([Aa]uto|[a-z]{2,3}(-[A-Za-z0-9]{2,8})*)$
          description: ISO 639-1 language code from the Minimax language set.
        gender:
          type: string
          enum:
            - male
            - female
            - neutral
          description: Gender of the voice clone.
        ref_text:
          type: string
          description: >-
            Optional transcript of the audio file. Providing this improves clone
            quality.
        label:
          type: string
          description: Optional custom label describing the voice style.
        model_id:
          type:
            - string
            - 'null'
          enum:
            - speech-2.8-turbo
            - null
          description: TTS model identifier. Nullable — defaults to speech-2.8-turbo.
        provider:
          type: string
          enum:
            - minimax
            - Minimax
          description: Voice synthesis provider. Must be `minimax`.
    VoiceCloneData:
      type: object
      description: A voice clone object.
      properties:
        record_type:
          type: string
          enum:
            - voice_clone
          description: Identifies the resource type.
        id:
          type: string
          format: uuid
          description: Unique identifier for the voice clone.
        source_voice_design_id:
          type:
            - string
            - 'null'
          format: uuid
          description: UUID of the source voice design. `null` for upload-based clones.
        source_voice_design_version:
          type:
            - integer
            - 'null'
          description: >-
            Version of the source voice design used. `null` for upload-based
            clones.
        name:
          type: string
          description: Name of the voice clone.
        language:
          type:
            - string
            - 'null'
          description: ISO 639-1 language code of the voice clone.
        gender:
          type:
            - string
            - 'null'
          enum:
            - male
            - female
            - neutral
            - null
          description: Gender of the voice clone.
        label:
          type:
            - string
            - 'null'
          description: >-
            Voice style description. If not explicitly set on upload, falls back
            to the source design's prompt text.
        created_at:
          type: string
          format: date-time
          description: Timestamp when the voice clone was created.
        updated_at:
          type: string
          format: date-time
          description: Timestamp when the voice clone was last updated.
        provider:
          type: string
          enum:
            - telnyx
            - minimax
            - Telnyx
            - Minimax
          description: Voice synthesis provider used for this clone.
        provider_supported_models:
          type: array
          items:
            type: string
          description: List of TTS model identifiers supported by this clone's provider.
        provider_voice_id:
          type:
            - string
            - 'null'
          description: >-
            Provider-specific voice identifier used for TTS synthesis. May
            differ from the clone UUID depending on the provider and model.
        model_id:
          type: string
          enum:
            - Qwen3TTS
            - Ultra
            - speech-2.8-turbo
          description: TTS model identifier for the voice clone.
        status:
          type: string
          enum:
            - active
            - pending
            - failed
            - expired
          description: >-
            Clone status. pending for Ultra clones while on-prem import is in
            progress, active once ready, failed if verification timed out,
            expired if not kept alive.
    voice-designs_ErrorObject:
      type: object
      description: A single error object.
      properties:
        code:
          type: string
          description: Telnyx-specific error code.
        title:
          type: string
          description: Short, human-readable summary of the error.
        detail:
          type: string
          description: Detailed, human-readable explanation of the error.
        source:
          type: object
          description: Reference to the source of the error.
          properties:
            pointer:
              type: string
              description: A JSON Pointer (RFC 6901) to the field that caused the error.
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````