# AI视频翻译-创建合成任务 API Documentation

> 根据字幕数据创建音频合成任务，根据字幕和指定的音色生成翻译后的音频文件；

## Overview

This document describes how to call the **AI视频翻译-创建合成任务** API.

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

## 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**: `POST https://apis.xiaobao.ink/api/video_translation/synthesis`
- **Content-Type**: `application/json` (request body commonly `application/json` or `application/x-www-form-urlencoded` for POST)
- **HTTP Method**: `POST`

### Request Parameters

| Parameter | Required | Description |
|-----------|----------|-------------|
| `url` | Yes | 视频URL |
| `language` | Yes | 目标语言 |
| `subtitles` | Yes | 字幕数据数组 |

> **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/synthesis?key=你的密钥
```

## Details

## 请求参数说明：

| 名称 | 必填 | 类型 | 示例值 | 说明 |
| --- | --- | --- | --- | --- |
| url | 是 | string | https://example.com/video.mp4 | 视频URL |
| language | 否 | string | en | 目标语言 |
| subtitles | 是 | array | [{"start":0,"end":1830,"text":"Hello"}] | 字幕数据数组，每项包含start、end、text、speaker、voice |

## Response Example

```json
{
    "code": 200,
    "msg": "任务已提交",
    "data": {
        "id": 2,
        "task_id": "synthesis-task-456",
        "status": 1,
        "progress": 0
    }
}
```

## Error Codes

| Status / code | Description |
|---------------|-------------|
| 200 / success | Request successful |
| 400 | Invalid request parameters |
| 401 | Authentication failed, please check API Key |
| 402 | Insufficient account balance / points |
| 429 | Request rate limit exceeded |
| 500 | Internal server error |

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