Skip to main content
POST
/
voice_clones
/
from_upload
JavaScript
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);
{
  "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"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data

Multipart form data for creating a voice clone from a direct audio upload.

audio_file
file
required

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

name
string
required

Name for the voice clone.

Maximum string length: 255
language
string
required

ISO 639-1 language code (e.g. en, fr) or auto for automatic detection.

Pattern: ^([Aa]uto|[a-z]{2,3}(-[A-Za-z0-9]{2,8})*)$
gender
enum<string>

Gender of the voice clone.

Available options:
male,
female,
neutral
ref_text
string

Optional transcript of the audio file. Providing this improves clone quality.

label
string

Optional custom label describing the voice style. If omitted, falls back to the source design's prompt text.

Response

Voice clone created successfully from the uploaded audio.

Response envelope for a single voice clone.

data
object

A voice clone object.