# 声音克隆 - 任务查询 API Documentation

> 查询声音克隆任务结果。配合声音克隆创建接口使用，创建后用 task_id 轮询。查询不扣费。支持 GET / POST。

## Overview

This document describes how to call the **声音克隆 - 任务查询** API.

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

## 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|POST https://apis.xiaobao.ink/api/aihuman/clonevoice_query`
- **Content-Type**: `application/json` (request body commonly `application/json` or `application/x-www-form-urlencoded` for POST)
- **HTTP Method**: `GET / POST`
- **Note**: This endpoint accepts both GET query parameters and POST form/JSON body.

### Request Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `task_id` | Yes | 声音克隆创建接口返回的任务ID |

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

### Request Example

```
https://apis.xiaobao.ink/api/aihuman/clonevoice_query?task_id=你的task_id&key=你的密钥
```

## Details

## 接口说明：

配合声音克隆创建接口使用。创建任务后，用返回的 `task_id` 查询结果。试听音频会转存到本站，请及时下载。查询不扣费。

**请求方法：**支持 `GET` 与 `POST`（表单或 JSON Body 均可传 `task_id`）。

关联创建：[声音克隆](/doc/9)

## 请求HEADER：

| 名称 | 值 |
| --- | --- |
| Content-Type | application/json 或 application/x-www-form-urlencoded（POST 时） |

## 请求参数说明：

| 名称 | 必填 | 类型 | 示例值 | 说明 |
| --- | --- | --- | --- | --- |
| task_id | 是 | string | c546950a3f415eae | 创建接口返回的任务ID；GET 查询参数，或 POST 表单/JSON |

## 返回参数说明：

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| task_id | string | 任务ID |
| status | int | 0 处理中，1 成功，2 失败 |
| name | string | 声音名称 |
| lang | string | 克隆语言 |
| voice_id | string | 音色ID，仅成功时有值 |
| demo_url | string | 试听音频（本站可访问），仅成功时有值 |
| fail_reason | string | 失败原因 |
| power_cost | number | 本平台实际扣点 |

处理中请间隔数秒再次查询；status 为 1 / 2 时停止。

## Response Example

```json
{
    "code": 200,
    "msg": "查询成功",
    "data": {
        "task_id": "c546950a3f415eae",
        "status": 1,
        "name": "主播001",
        "lang": "zh-cn",
        "voice_id": "c546950a3f415eae",
        "demo_url": "https://apis.xiaobao.ink/upload/audio/2025/12/28/demo.wav",
        "fail_reason": "",
        "power_cost": 200
    }
}
```

## Error Codes

| HTTP 响应状态码 | 说明 |
| --- | --- |
| 200 | 查询成功 |
| 400 | 缺少 task_id 或任务不存在 |
| 401 | 认证失败，请检查 key |

## 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}`)._
