> ## 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: 2MB.



## OpenAPI

````yaml /openapi/voice-clones.yml post /voice_clones/from_upload
openapi: 3.1.0
info:
  title: Voice Clones API
  version: 2.0.0
  description: >-
    Capture and manage voice identities as clones for use in text-to-speech
    synthesis.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
tags:
  - name: Voice Clones
    description: >-
      Capture and manage voice identities as clones for use in text-to-speech
      synthesis.
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: 2MB.
      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'
        '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({
              audio_file: fs.createReadStream('path/to/file'),
              language: 'lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf',
              name: 'name',
            });

            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(
                audio_file=b"Example data",
                language="lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf",
                name="name",
            )
            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\tAudioFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\tLanguage:  \"lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf\",\n\t\tName:      \"name\",\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 = VoiceCloneCreateFromUploadParams.builder()
                        .audioFile(new ByteArrayInputStream("Example data".getBytes()))
                        .language("lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf")
                        .name("name")
                        .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(
              audio_file: StringIO.new("Example data"),
              language: "lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf",
              name: "name"
            )

            puts(response)
        - lang: CLI
          source: |-
            telnyx voice-clones create-from-upload \
              --api-key 'My API Key' \
              --audio-file 'Example data' \
              --language lkf-Lz1vLbBu-9uDh-9AHaOS2D-Cbf \
              --name name
components:
  schemas:
    VoiceCloneUploadRequest:
      type: object
      description: >-
        Multipart form data for creating a voice clone from a direct audio
        upload.
      required:
        - audio_file
        - language
        - name
      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 for Telnyx, 20MB for
            Minimax.
        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 (e.g. `en`, `fr`) or `auto` for automatic
            detection.
        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. If omitted, falls
            back to the source design's prompt text.
        provider:
          type: string
          enum:
            - telnyx
            - minimax
            - Telnyx
            - Minimax
          default: telnyx
          description: Voice synthesis provider. Case-insensitive. Defaults to `telnyx`.
    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
    voice-designs_ErrorResponse:
      type: object
      description: Standard error response envelope.
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorObject'
      example:
        errors:
          - code: '10005'
            title: Resource not found
            detail: Voice design not found
    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. For
            Telnyx clones this equals the clone ID; for Minimax it is the
            Minimax-assigned voice ID.
    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.

````