Video Translation V4 API
Last Updated: 2026-06-03
- Creates a video translation task and retrieves the video translation processing result by task ID.
- Supports task creation, task status polling, translated video URL, translated audio URL, source subtitle URL, target subtitle URL, and other result fields.
- This is an asynchronous task flow: after a task is created, the API returns a
taskId; the client then polls the result retrieval API for task status and output results.
The Video Translation API uses a console-based project access model. You can register and activate services on the ViiTor AI official website, then create a project in the console to obtain required authentication credentials.
The business service endpoint is provided by the project gateway. This document uses the following gateway as an example:
https://video-translation.viitor.com
- Request URL:
https://video-translation.viitor.com/videoTranslate/create - Method:
POST - Content-Type:
application/json - Response Format:
{code, message, data}
| Header | Required | Type | Description |
|---|
Content-Type | Yes | String | application/json;charset=UTF-8 |
Accept | Recommended | String | application/json;charset=UTF-8 |
X-User-Id | Yes | Long | User ID, must be numeric |
X-Channel | Yes | Integer | Channel code: 100=Web, 200=Android, 300=iOS |
X-App-Source | No | String | Source marker, up to 20 characters; defaults to an empty string if omitted |
Authorization | Recommended | String | Login token (Bearer Token), based on gateway auth policy |
Notes:
- The server uses
X-User-Id, X-Channel, and X-App-Source from the headers to overwrite fields with the same names in the request body. - Missing
X-User-Id or X-Channel returns code=2000. - The token in
Authorization can be obtained after registering and logging in on the ViiTor AI official website. Pass it in the format Bearer <token>.
| Field | Type | Required | Description |
|---|
sourceVideoUrl | String | Yes | Source video URL |
targetLanguage | String | Yes | Target language code, must be in the supported language list |
sourceLanguage | String | No | Source language code; if omitted, it will be detected in the later process |
videoName | String | Yes | Video task name; if longer than 255 characters, it will be truncated to the first 255 characters |
costPoint | Integer | Yes | Points consumed by this task; must be greater than or equal to 500 |
subtitle | Integer | No | Subtitle type: 0=default no subtitle, 1=source subtitle, 2=target subtitle, 3=bilingual subtitle; defaults to 0 if omitted |
timeLinePattern | Integer | No | Timeline mode, fixed value 1 |
sourceVideoUrl, targetLanguage, videoName, and costPoint cannot be empty.targetLanguage and sourceLanguage must be supported language codes.subtitle only allows 0/1/2/3.costPoint must be greater than or equal to 500.- After successful creation, the initial task status is created, and the task is processed asynchronously.
targetLanguage must use a supported language code. If sourceLanguage is provided, it is validated using the same language code list.
| Language Code | Chinese Name | English Name |
|---|
zh-CN | 中文 | Chinese (Mandarin) |
zh-cn | 中文 | Chinese (Mandarin), lowercase compatible |
zh-tw | 繁体中文 | Chinese Traditional |
zh-yue | 粤语 | Cantonese |
en | 英语 | English |
ja | 日语 | Japanese |
ko | 韩语 | Korean |
ar | 阿拉伯语 | Arabic |
tl | 菲律宾语 | Filipino |
fr | 法语 | French |
de | 德语 | German |
hi | 印地语 | Hindi |
id | 印度尼西亚语 | Indonesian |
it | 意大利语 | Italian |
ms | 马来语 | Malay |
pt | 葡萄牙语 | Portuguese |
ru | 俄语 | Russian |
es | 西班牙语 | Spanish |
th | 泰语 | Thai |
tr | 土耳其语 | Turkish |
vi | 越南语 | Vietnamese |
fa | 波斯语 | Persian |
sk | 斯洛伐克语 | Slovak |
sl | 斯洛文尼亚语 | Slovenian |
cs | 捷克语 | Czech |
pl | 波兰语 | Polish |
ro | 罗马尼亚语 | Romanian |
hu | 匈牙利语 | Hungarian |
sv | 瑞典语 | Swedish |
fi | 芬兰语 | Finnish |
nb | 挪威语 | Norwegian |
nl | 荷兰语 | Dutch |
uk | 乌克兰语 | Ukrainian |
costPoint is the number of points pre-deducted for this task. When creating a task, the client needs to estimate and pass the value based on video duration. The server first pre-deducts points based on this value. After preprocessing obtains the real video duration, the server validates whether the submitted costPoint is lower than the actual required points.
Current base point rules for video translation:
videoDurationSeconds = ceil(sourceVideoDurationMs / 1000)
billingUnitCount = ceil(videoDurationSeconds / VIDEO_TRANSLATE_UNIT)
costPoint = billingUnitCount * VIDEO_TRANSLATE_POINT
Default billing configuration:
| Config | Default Value | Description |
|---|
VIDEO_TRANSLATE_UNIT | 30 | One billing unit per 30 seconds |
VIDEO_TRANSLATE_POINT | 1250 | 1250 points per billing unit |
sourceVideoDurationMs | - | Source video duration in milliseconds |
Calculation examples:
| Video Duration | Billing Units | costPoint |
|---|
| 1-30 seconds | 1 | 1250 |
| 31-60 seconds | 2 | 2500 |
| 61-90 seconds | 3 | 3750 |
Notes:
- Durations shorter than one billing unit are billed as one billing unit.
- If the client submits a
costPoint lower than the value calculated by the server based on the real video duration, the server returns an inaccurate points error. The typical error code is 10039. - Billing rules may be dynamically adjusted by backend configuration. Client-side price display should follow online configuration or server-returned rules.
| Field | Type | Description |
|---|
code | Integer | 0 means success; non-zero means failure |
message | String | Response message |
data | Object | Business data |
| Field | Type | Description |
|---|
taskId | String | Task ID, used to query the result later |
curl -X POST "https://video-translation.viitor.com/videoTranslate/create" \
-H "Content-Type: application/json" \
-H "Accept: application/json;charset=UTF-8" \
-H "Authorization: Bearer <TOKEN>" \
-H "X-User-Id: 123456" \
-H "X-Channel: 100" \
-H "X-App-Source: official_web" \
-d '{
"sourceVideoUrl": "https://cdn.example.com/video/source.mp4",
"videoName": "Video Translation Task 001",
"sourceLanguage": "zh-CN",
"targetLanguage": "en",
"costPoint": 1250,
"subtitle": 2,
"timeLinePattern": 1
}'
{
"code": 0,
"message": "OK",
"data": {
"taskId": "ViiTor_AI_50C7A13A74DC46D8B31EAEF3382895BA"
}
}
{
"code": 2001,
"message": "Invalid Parameter",
"data": null
}
- Request URL:
https://video-translation.viitor.com/videoTranslate/result - Method:
POST - Content-Type:
application/json - Response Format:
{code, message, data}
| Header | Required | Type | Description |
|---|
Content-Type | Yes | String | application/json;charset=UTF-8 |
Accept | Recommended | String | application/json;charset=UTF-8 |
X-User-Id | Yes | Long | User ID, must be numeric |
Authorization | Recommended | String | Login token (Bearer Token), based on gateway auth policy |
X-Channel | No | Integer | Channel code; not used in business logic for this API |
X-App-Source | No | String | Source marker; not used in business logic for this API |
Notes:
- This API only uses
X-User-Id from the headers as the query user. - Only tasks created by the current user and not deleted can be queried.
- The token in
Authorization can be obtained after registering and logging in on the ViiTor AI official website. Pass it in the format Bearer <token>.
| Field | Type | Required | Description |
|---|
taskId | String | Yes | Video translation task ID |
taskId cannot be empty.taskId must belong to the current user and must not be deleted.- If the task does not exist, the API returns
code=10022.
| Field | Type | Description |
|---|
code | Integer | 0 means success; non-zero means failure |
message | String | Response message |
data | Object | Task result data |
| Field | Type | Description |
|---|
taskId | String | Task ID |
videoName | String | Video task name |
taskStatus | Integer | Task status: 1=Created, 2=Queued, 3=Running, 4=Finished, 5=Failed, 6=Aborted |
errorCode | Integer | Task error code; usually 0 for success |
taskProcessStatus | Integer | In-process execution status |
sourceLanguage | String | Source language code |
targetLanguage | String | Target language code |
sourceVideoUrl | String | Source video URL |
targetVideoUrl | String | Translated video URL, returned after task completion |
targetAudioUrl | String | Translated audio URL, returned after task completion |
sourceSubtitleUrl | String | Source subtitle file URL |
targetSubtitleUrl | String | Target subtitle file URL |
sourceThumbnailUrl | String | Source video thumbnail URL |
videoDuration | Long | Video duration; currently returns the source video duration |
subtitle | Integer | Subtitle type: 0=default no subtitle, 1=source subtitle, 2=target subtitle, 3=bilingual subtitle |
createTime | Long | Creation time, millisecond timestamp |
| Value | Meaning |
|---|
1 | Created |
2 | Queued |
3 | Running |
4 | Finished |
5 | Failed |
6 | Aborted |
curl -X POST "https://video-translation.viitor.com/videoTranslate/result" \
-H "Content-Type: application/json" \
-H "Accept: application/json;charset=UTF-8" \
-H "Authorization: Bearer <TOKEN>" \
-H "X-User-Id: 123456" \
-d '{
"taskId": "ViiTor_AI_50C7A13A74DC46D8B31EAEF3382895BA"
}'
{
"code": 0,
"message": "OK",
"data": {
"taskId": "ViiTor_AI_50C7A13A74DC46D8B31EAEF3382895BA",
"videoName": "Video Translation Task 001",
"taskStatus": 3,
"taskProcessStatus": 40,
"errorCode": 0,
"sourceLanguage": "zh-CN",
"targetLanguage": "en",
"sourceVideoUrl": "https://cdn.example.com/video/source.mp4",
"targetVideoUrl": null,
"subtitle": 2,
"createTime": 1779696000000
}
}
{
"code": 0,
"message": "OK",
"data": {
"taskId": "ViiTor_AI_50C7A13A74DC46D8B31EAEF3382895BA",
"videoName": "Video Translation Task 001",
"taskStatus": 4,
"errorCode": 0,
"taskProcessStatus": 9999,
"sourceLanguage": "zh-CN",
"targetLanguage": "en",
"targetVideoUrl": "https://cdn.example.com/video/target.mp4",
"targetAudioUrl": "https://cdn.example.com/audio/target.mp3",
"sourceSubtitleUrl": "https://cdn.example.com/subtitle/source.srt",
"targetSubtitleUrl": "https://cdn.example.com/subtitle/target.srt",
"sourceThumbnailUrl": "https://cdn.example.com/image/cover.jpg",
"videoDuration": 60000,
"subtitle": 2,
"createTime": 1779696000000
}
}
{
"code": 10022,
"message": "taskid is not exist",
"data": null
}
| Code | Meaning | Typical Cause |
|---|
2000 | Missing Parameter | Missing required header, such as X-User-Id or X-Channel, or missing required parameter |
2001 | Invalid Parameter | Invalid parameter, such as unsupported language, invalid subtitle, or invalid costPoint |
10022 | taskid is not exist | Task does not exist, has been deleted, or does not belong to the current user |
10039 | inaccurate points | Inaccurate points |
10090 | insufficient equity | Insufficient entitlement |
10091 | insufficient points | Insufficient user points |
- Call
/videoTranslate/create first to create a task and obtain taskId. - Then call
/videoTranslate/result to poll task status. - When
taskStatus=4 and taskProcessStatus=9999, the task is considered finished. The client can read result fields such as targetVideoUrl, targetAudioUrl, sourceSubtitleUrl, and targetSubtitleUrl. - When
taskStatus=5, the task is considered failed. The client should read errorCode and display the failure reason. - Apply unified exception handling for
code != 0, especially parameter errors, task not found, and insufficient points.