Skip to main content

Voice Upload Endpoint

Overview

The audio voice endpoint allows you to upload audio and use the voice_id returned with Text To Audio Endpoint

Request

--request POST 'https://modelslab.com/api/v6/voice/voice_upload' \

Make a POST request to https://modelslab.com/api/v6/voice/voice_upload endpoint and pass the required parameters as a request body.

Body Attributes

ParameterDescriptionValues
keyYour API Key used for request authorizationstring
nameDisplay name of the voice you want to uploadstring
init_audioAudio URL of the voice file to upload. Only MP3 and WAV formats are allowed. Should be 10-25 seconds long for best results.URL
base64to upload base64 string, true or falseboolean
languageLanguage of the voice. Ensure it matches the language of the uploaded voice.One of ["english", "arabic", "spanish", "german", "czech", "brazilian portuguese", "chinese", "dutch", "french", "hindi", "hungarian", "italian", "japanese", "korean", "polish", "russian", "turkish"]

Example

Body

Body
{   
"key":"",
"name":"Jacob",
"init_audio":"https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/jacob.wav",
"language":"english"
}

Request

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"key":"",
"name":"Jacob",
"init_audio":"https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/jacob.wav",
"language":"english"
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("https://modelslab.com/api/v6/voice/voice_upload", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));

Response

{
"status": "success",
"message": "voice uploaded successfully",
"voice_id": "jacob"
}