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

# Upload Voice Reference

> Upload a voice reference audio file to get a voice_id for use in TTS requests.

`POST /api/v1/generate/upload`

**Content-Type:** `multipart/form-data`

Upload a short voice reference clip to obtain a `voice_id` that can be reused across TTS requests without re-uploading the audio file each time.

**Supported models:** `higgs2p5`, `chatterbox`, `qwen3-tts` (Base mode only)

## Authentication

Send your API key in the `Authorization` header as a Bearer token.

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Parameters

| Name                   | Type     | Required | Description                                                                          |
| ---------------------- | -------- | -------- | ------------------------------------------------------------------------------------ |
| `model`                | `string` | Required | The TTS model to associate the voice with: `higgs2p5`, `chatterbox`, or `qwen3-tts`. |
| `voice_reference_file` | `file`   | Required | Voice reference audio file (WAV or MP3 recommended).                                 |

## Response

```json theme={null}
{
  "voice_id": "abc123def456..."
}
```

Use the returned `voice_id` as the `voice_id` parameter in subsequent [Generate Audio](/products/model-api/api-reference/generate-audio) or [Stream Audio](/products/model-api/api-reference/stream-audio) requests.

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api-web.eigenai.com/api/v1/generate/upload \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -F "model=higgs2p5" \
    -F "voice_reference_file=@/path/to/reference.wav"
  ```

  ```python Python theme={null}
  import requests

  url = "https://api-web.eigenai.com/api/v1/generate/upload"
  headers = {"Authorization": "Bearer YOUR_API_KEY"}

  with open("reference.wav", "rb") as f:
      response = requests.post(
          url,
          headers=headers,
          data={"model": "higgs2p5"},
          files={"voice_reference_file": ("reference.wav", f, "audio/wav")},
          timeout=60,
      )
  response.raise_for_status()
  voice_id = response.json()["voice_id"]
  print(f"Voice ID: {voice_id}")

  # Use voice_id in a TTS request
  tts_response = requests.post(
      "https://api-web.eigenai.com/api/v1/generate",
      headers=headers,
      data={"model": "higgs2p5", "text": "Hello!", "voice_id": voice_id},
      timeout=120,
  )
  tts_response.raise_for_status()
  with open("output.wav", "wb") as out:
      out.write(tts_response.content)
  ```

  ```javascript JavaScript theme={null}
  import fs from "node:fs";

  // Upload voice reference
  const uploadForm = new FormData();
  uploadForm.append("model", "higgs2p5");
  uploadForm.append("voice_reference_file", fs.createReadStream("reference.wav"));

  const uploadResponse = await fetch("https://api-web.eigenai.com/api/v1/generate/upload", {
    method: "POST",
    headers: { Authorization: "Bearer YOUR_API_KEY" },
    body: uploadForm,
  });
  if (!uploadResponse.ok) throw new Error(`Upload failed: ${uploadResponse.status}`);
  const { voice_id } = await uploadResponse.json();
  console.log("Voice ID:", voice_id);

  // Use voice_id in a TTS request
  const ttsForm = new FormData();
  ttsForm.append("model", "higgs2p5");
  ttsForm.append("text", "Hello!");
  ttsForm.append("voice_id", voice_id);

  const ttsResponse = await fetch("https://api-web.eigenai.com/api/v1/generate", {
    method: "POST",
    headers: { Authorization: "Bearer YOUR_API_KEY" },
    body: ttsForm,
  });
  if (!ttsResponse.ok) throw new Error(`TTS failed: ${ttsResponse.status}`);
  const buffer = Buffer.from(await ttsResponse.arrayBuffer());
  fs.writeFileSync("output.wav", buffer);
  ```
</CodeGroup>
