# AI视频翻译-获取语音列表 API Documentation

> 获取指定语言的可用音色列表，用于在创建预览任务时选择合适的配音音色；AI视频翻译支持70余种全球主流语言的翻译；

## Overview

This document describes how to call the **AI视频翻译-获取语音列表** API.

- **Model / path slug**: `video_translation/voices`
- **Task type**: `sync` (`sync` = synchronous, `async` = create task then poll / callback)
- **HTML docs**: `/doc/32`

## Authentication

All API requests require your platform API key as the query parameter `key`:

```
?key=YOUR_API_KEY
```

Get API Key:
1. Sign in to the console
2. Open [API Key Management](/user/key) and create or copy your key
3. Append `key=YOUR_API_KEY` to the request URL (or pass it in form/JSON when the endpoint accepts it)

---

## API Information

- **URL**: `GET https://apis.xiaobao.ink/api/video_translation/voices`
- **Content-Type**: `application/json` (request body commonly `application/json` or `application/x-www-form-urlencoded` for POST)
- **HTTP Method**: `GET`

### Request Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `language` | Yes | 目标语言代码（如zh-CN、en-US） |

> **Note**: `key` (API key) is required for authenticated calls even if omitted from the parameter list above.

### Request Example

```
https://apis.xiaobao.ink/api/video_translation/voices?language=zh-CN&key=你的密钥
```

## Details

## 请求HEADER：

| 名称 | 值 |
| --- | --- |
| Content-Type | application/json |

## 请求参数说明：

| 名称 | 必填 | 类型 | 示例值 | 说明 |
| --- | --- | --- | --- | --- |
| language | 是 | string | zh-CN | 目标语言代码，如：zh-CN、en-US、en。如果包含下划线，会自动提取第一部分 |

## 返回参数说明：

| code | int | 状态 200 成功 |
| --- | --- | --- |
| msg | string | 响应消息 |
| data.items[n].voice  | string | 音色名称/标题 |
| data.items[n].title  | string | 原始字幕列表 |
| data.items[n].tags  | array | 音色标签数组 |
| data.items[n].icon   | string | 音色图标URL |
| data.items[n].url  | string | 音色试听音频URL |
| data.items[n].gender  | int | 性别（1-男声，2-女声） |
| data.items[n].language_local_code  | string | 语言代码 (zh-CN) |
| data.total | int | 总数 |
| data.language | string | 目标语言代码 |
| exec_time | string | 运行时长 |
| ip | string | ip地址 |

## Response Example

```json
{
    "code": 200,
    "msg": "success",
    "data": {
        "items": [
            {
                "voice": "cv_longanhuan",
                "title": "温柔女声",
                "tags": [
                    "温柔",
                    "女声"
                ],
                "icon": "https://example.com/icon.png",
                "url": "https://example.com/preview.mp3",
                "gender": 2,
                "language_local_code": "zh-CN"
            }
        ],
        "total": 1,
        "language": "zh"
    }
}
```

## Error Codes

| 错误码 | 类型 | 说明 |
| --- | --- | --- |
| 403 | int | 没有权限（密钥无效等） |
| 400 | int | 参数传递不正确 / 业务失败 |
| 500 | int | 服务器内部错误 |

## Usage Flow

1. Obtain your API Key from the console
2. Call the endpoint with `key` and required parameters
3. Parse the JSON (or binary) response according to the examples above

---

_Generated for AI / LLM consumption. Source of truth: `api_list` (same as HTML `/doc/{id}`)._
