Upload audio samples for voice cloning

December 27, 2024 (August 24, 2026)

Table of contents

  1. Request Headers
  2. Query Parameters
  3. Responses
  4. Model
  5. Examples
  6. Try It

Upload .mp3 and .wav audio samples that you want to use for your voice cloning via POST speech/clone-voice. Each audio sample should be between 10 to 60 seconds long.

POST raw content using Make.com and similar nocode tools.

https://api.useapi.net/v1/minimax/speech/upload-sample/?…

Request Headers
Authorization: Bearer {API token}
Content-Type: select from the table below
  • API token is required, see Setup useapi.net for details.
  • Content-Type is required, select from the table below:
Content-Type File Extension
audio/mpeg mp3
audio/wav wav
audio/wave wav
Query Parameters
  • account is optional when only one account configured. However, if you have multiple accounts configured, this parameter becomes required.
Responses
  • 200 OK

    {
        "ossPath": "<file url>",
        "fileID": "user:user_id-minimax:account-file:file_id"
    }
    
  • 400 Bad Request

    {
        "error": "<Error message>",
        "code": 400
    }
    
  • 401 Unauthorized

    {
      "error": "Unauthorized",
      "code": 401
    }
    
  • 596 Account Error

    {
      "error": "Your minimax account has pending error. Please address this issue at https://useapi.net/docs/api-minimax-v1/post-minimax-accounts-account before making any new API calls.",
      "code": 596
    }
    
Model
{ // TypeScript, all fields are optional
  ossPath: string
  fileID: string
  error: string
  code: number
}
Examples
  • curl "https://api.useapi.net/v1/minimax/speech/upload-sample/?account=account" \
      -H "Authorization: Bearer …" \
      -H "Content-Type: audio/mpeg" \
      --data-binary /path/to/your/voice-sample.mp3
    
  • const token = "API token";
    const account = "Previously configured account"; 
    const apiUrl = `https://api.useapi.net/v1/minimax/speech/upload-sample/?account=${account}`; 
    let blob;
    /*
        // Example 1: Fetch audio from URL
        const audioUrl = "https://upload.wikimedia.org/wikipedia/commons/voice-sample.mp3";
        const responseAudio = await fetch(audioUrl);
        blob = await responseAudio.blob();
    */
    /* 
        // Example 2: Load audio from local file (Blob)
        const fsp = require('fs').promises;
        const audioFileName = "./voice-sample.mp3";
        blob = new Blob([await fsp.readFile(audioFileName)]);
    */
    /*
        // Example 3: Load from input file html element
        // <input id="audio-file" type="file"> 
        const audioFile = document.getElementById(`audio-file`);
        if (audioFile.files[0])
            blob = audioFile.files[0]);
    */
    const response = await fetch(apiUrl, {
      method: "POST"
      headers: {
        "Authorization": `Bearer ${token}`,
      },
      body: blob
    });
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    token = "API token"
    account = "Previously configured account"
    apiUrl = f"https://api.useapi.net/v1/minimax/speech/upload-sample/?account={account}"
    headers = {
        'Authorization': f'Bearer {token}',
        'Content-Type': 'audio/mpeg'
    }
    
    # # Example 1: Fetch audio from URL
    # audio_url = "https://upload.wikimedia.org/wikipedia/commons/voice-sample.mp3"
    # response_audio = requests.get(audio_url)
    # file_content = response_audio.content
    
    # # Example 2: Load audio from local file
    # audio_file_path = "./voice-sample.mp3"
    # with open(audio_file_path, 'rb') as audio_file:
    #     file_content = audio_file.read()
    
    response = requests.post(api_url, headers=headers, data=file_content)
    print(response, response.json())
    
Try It