SubmitTranslationTask — Submit a translation task

Updated at:
Copy as MD
Warning

This endpoint consumes Credits. Ensure the account has enough Credits before submitting. You can use the CreditsAvailable field returned by UploadTranslationFile as a preliminary reference; the submission result is final. If the balance is insufficient, the request fails with Credits.NotEnough.

Note

Rate limit: 5 QPS per account, concurrency 5.

Request parameters

Parameter

Type

Required

Description

TaskId

string

Conditional

Task ID obtained from UploadTranslationFile. Use this for new translations. Mutually exclusive with BaseTaskId; pass exactly one of the two.

BaseTaskId

string

Conditional

The TaskId of a previously completed or failed task to retranslate. The system reuses the original file, so no re-upload is needed. Mutually exclusive with TaskId; pass exactly one of the two.

Config

object

Yes

Required. Translation config.

Config.SourceLanguage

string

Yes

Required. Source language code. Full list:

Code

Language

zh

Chinese

en

English

ja

Japanese

ko

Korean

fr

French

de

German

ru

Russian

ar

Arabic

vi

Vietnamese

id

Indonesian

ms

Malay

th

Thai

pt-BR

Portuguese (Brazil)

es-MX

Spanish (Mexico)

tr

Turkish

Not all combinations are supported. Available pairs depend on the file type.

Config.TargetLanguage

string

Yes

Required. Target language code. Same values as Config.SourceLanguage; see the table above.

SourceLanguage and TargetLanguage must form a supported language pair. For document translation, see Document Translation Supported Formats & Languages; for video translation, see Video Translation Supported Language Pairs. When translating an MP4, set Config.SourceLanguage to the actual language code of the source video and choose Config.TargetLanguage from the video translation language pairs. For example, to translate an English video into Chinese, set the source language to en and the target language to zh.

Config.Font

string

No

Target font. Available values come from the Fonts field returned by UploadTranslationFile; for re-translation of a historical task, use GetTranslationTask to fetch them.

Config.Style

string

No

Translation style. Only effective for PPT files. normal — Standard, fully preserves the original content. minimal — More condensed content and refined layout.

Config.AgentId

string

No

Agent ID from the Agent Console platform. Used to associate the translation task with a specific agent configuration. Only required when submitting tasks through an integrated agent workflow.

CustomTerms

array<object>

No

Custom terminology list, up to 100 entries. Only affects the current task.

CustomTerms[].SourceTerm

string

-

Source term.

CustomTerms[].TargetTerm

string

-

Target term.

Note

Custom terms are advisory only; the actual translation may vary. The final output prevails.

Response parameters

Field

Type

Description

TaskId

string

Translation task ID.

Status

string

Task status. Usually PENDING after submission. Possible values: ANALYZED, PENDING, PROCESSING, COMPLETED, FAILED, CANCELLED

Example

Java — new task

import com.aliyun.realtranslationagent20260622.models.*;

import java.util.ArrayList;
import java.util.List;

// Build translation config
// Note: When translating an MP4, explicitly set SourceLanguage to the actual language
// of the source video (e.g. "en"). Do not rely on DetectedLang from UploadTranslationFile,
// which may return a default value for video files.
SubmitTranslationTaskRequest.SubmitTranslationTaskRequestConfig config =
        new SubmitTranslationTaskRequest.SubmitTranslationTaskRequestConfig()
                .setSourceLanguage("zh")
                .setTargetLanguage("en")
                .setFont("Calibri")
                .setStyle("normal");

// Build custom terms (optional)
List<SubmitTranslationTaskRequest.SubmitTranslationTaskRequestCustomTerms> customTerms = new ArrayList<>();
customTerms.add(new SubmitTranslationTaskRequest.SubmitTranslationTaskRequestCustomTerms()
        .setSourceTerm("人工智能")
        .setTargetTerm("Artificial Intelligence"));
customTerms.add(new SubmitTranslationTaskRequest.SubmitTranslationTaskRequestCustomTerms()
        .setSourceTerm("机器学习")
        .setTargetTerm("Machine Learning"));

// Submit the task
SubmitTranslationTaskRequest request = new SubmitTranslationTaskRequest()
        .setTaskId("your-task-id")  // from UploadTranslationFile
        .setConfig(config)
        .setCustomTerms(customTerms);

SubmitTranslationTaskResponse response = client.submitTranslationTask(request);
System.out.println("TaskId: " + response.getBody().getData().getTaskId());
System.out.println("Status: " + response.getBody().getData().getStatus());

Java — retranslate

SubmitTranslationTaskRequest.SubmitTranslationTaskRequestConfig config =
        new SubmitTranslationTaskRequest.SubmitTranslationTaskRequestConfig()
                .setSourceLanguage("zh")
                .setTargetLanguage("ja")
                .setFont("MS Mincho");

SubmitTranslationTaskRequest request = new SubmitTranslationTaskRequest()
        .setBaseTaskId("history-task-id")  // historical task ID
        .setConfig(config);

SubmitTranslationTaskResponse response = client.submitTranslationTask(request);

Python — new task

from alibabacloud_realtranslationagent20260622.models import (
    SubmitTranslationTaskRequest,
    SubmitTranslationTaskRequestConfig,
    SubmitTranslationTaskRequestCustomTerms,
)

config = SubmitTranslationTaskRequestConfig(
    source_language="zh",
    target_language="en",
    font="Calibri",
    style="normal"
)

custom_terms = [
    SubmitTranslationTaskRequestCustomTerms(source_term="人工智能", target_term="Artificial Intelligence"),
    SubmitTranslationTaskRequestCustomTerms(source_term="机器学习", target_term="Machine Learning"),
]

request = SubmitTranslationTaskRequest(
    task_id="your-task-id",
    config=config,
    custom_terms=custom_terms
)

response = client.submit_translation_task(request)
print(f"TaskId: {response.body.data.task_id}")
print(f"Status: {response.body.data.status}")

Node.js — new task

import {
    SubmitTranslationTaskRequest,
    SubmitTranslationTaskRequestConfig,
    SubmitTranslationTaskRequestCustomTerms,
} from '@alicloud/realtranslationagent20260622';

const config = new SubmitTranslationTaskRequestConfig({
    sourceLanguage: 'zh',
    targetLanguage: 'en',
    font: 'Calibri',
    style: 'normal',
});

const customTerms = [
    new SubmitTranslationTaskRequestCustomTerms({ sourceTerm: '人工智能', targetTerm: 'Artificial Intelligence' }),
    new SubmitTranslationTaskRequestCustomTerms({ sourceTerm: '机器学习', targetTerm: 'Machine Learning' }),
];

const request = new SubmitTranslationTaskRequest({
    taskId: 'your-task-id',
    config,
    customTerms,
});

const response = await client.submitTranslationTask(request);
console.log('TaskId:', response.body.data.taskId);
console.log('Status:', response.body.data.status);

Python — retranslate

from alibabacloud_realtranslationagent20260622.models import (
    SubmitTranslationTaskRequest,
    SubmitTranslationTaskRequestConfig,
)

config = SubmitTranslationTaskRequestConfig(source_language="zh", target_language="ja", font="MS Mincho")
request = SubmitTranslationTaskRequest(base_task_id="history-task-id", config=config)
response = client.submit_translation_task(request)

Node.js — retranslate

import { SubmitTranslationTaskRequest, SubmitTranslationTaskRequestConfig } from '@alicloud/realtranslationagent20260622';

const config = new SubmitTranslationTaskRequestConfig({ sourceLanguage: 'zh', targetLanguage: 'ja', font: 'MS Mincho' });
const request = new SubmitTranslationTaskRequest({ baseTaskId: 'history-task-id', config });
const response = await client.submitTranslationTask(request);

Sample response

{
  "Data": {
    "TaskId": "f9c35b0453b",
    "Status": "PENDING"
  }
}

Notes

  • TaskId and BaseTaskId are mutually exclusive; do not pass both.

  • Style is only effective for PPT files; passing it for other formats has no effect.

  • After submission, Credits are frozen. On completion they are settled by actual consumption; on cancellation they are fully refunded.

  • When retranslating via BaseTaskId, the file upload step is skipped and no additional upload charge applies. Only the translation Credits for the new task are consumed.

Error codes

Code

Description

InvalidParameter

Parameter validation failed

InvalidParameter.Config

Translation config is invalid

Task.NotFound

Task does not exist or you have no access

Credits.NotEnough

Insufficient Credits balance

Sensitive.Blocked

Document contains blocked sensitive content

MissingConfig

Required Config parameter is missing (gateway-level error, HTTP 4xx)

MissingSourceLanguage

SourceLanguage is missing from the Config (gateway-level error, HTTP 4xx)

Throttling

Requests are too frequent; reduce the request rate and retry