StartTextTranslationJob - Amazon Translate API Reference

StartTextTranslationJob

Starts an asynchronous batch translation job. Use batch translation jobs to translate large volumes of text across multiple documents at once. For batch translation, you can input documents with different source languages (specify auto as the source language). You can specify one or more target languages. Batch translation translates each input document into each of the target languages. For more information, see Asynchronous batch processing in the Amazon Translate Developer Guide.

Batch translation jobs can be described with the DescribeTextTranslationJob operation, listed with the ListTextTranslationJobs operation, and stopped with the StopTextTranslationJob operation.

Request Syntax

{ "ClientToken": "string", "DataAccessRoleArn": "string", "InputDataConfig": { "ContentType": "string", "S3Uri": "string" }, "JobName": "string", "OutputDataConfig": { "EncryptionKey": { "Id": "string", "Type": "string" }, "S3Uri": "string" }, "ParallelDataNames": [ "string" ], "Settings": { "Brevity": "string", "Formality": "string", "Profanity": "string" }, "SourceLanguageCode": "string", "TargetLanguageCodes": [ "string" ], "TerminologyNames": [ "string" ] }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

ClientToken

A unique identifier for the request. This token is generated for you when using the Amazon Translate SDK.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 64.

Pattern: ^[a-zA-Z0-9-]+$

Required: Yes

DataAccessRoleArn

The Amazon Resource Name (ARN) of an AWS Identity Access and Management (IAM) role that grants Amazon Translate read access to your input data. For more information, see Prerequisite permissions in the Amazon Translate Developer Guide.

Type: String

Length Constraints: Minimum length of 20. Maximum length of 2048.

Pattern: arn:aws(-[^:]+)?:iam::[0-9]{12}:role/.+

Required: Yes

InputDataConfig

Specifies the format and location of the input documents for the translation job.

Type: InputDataConfig object

Required: Yes

JobName

The name of the batch translation job to be performed.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 256.

Pattern: ^([\p{L}\p{Z}\p{N}_.:/=+\-%@]*)$

Required: No

OutputDataConfig

Specifies the S3 folder to which your job output will be saved.

Type: OutputDataConfig object

Required: Yes

ParallelDataNames

The name of a parallel data resource to add to the translation job. This resource consists of examples that show how you want segments of text to be translated. If you specify multiple target languages for the job, the parallel data file must include translations for all the target languages.

When you add parallel data to a translation job, you create an Active Custom Translation job.

This parameter accepts only one parallel data resource.

Note

Active Custom Translation jobs are priced at a higher rate than other jobs that don't use parallel data. For more information, see Amazon Translate pricing.

For a list of available parallel data resources, use the ListParallelData operation.

For more information, see Customizing your translations with parallel data in the Amazon Translate Developer Guide.

Type: Array of strings

Length Constraints: Minimum length of 1. Maximum length of 256.

Pattern: ^([A-Za-z0-9-]_?)+$

Required: No

Settings

Settings to configure your translation output. You can configure the following options:

  • Brevity: not supported.

  • Formality: sets the formality level of the output text.

  • Profanity: masks profane words and phrases in your translation output.

Type: TranslationSettings object

Required: No

SourceLanguageCode

The language code of the input language. Specify the language if all input documents share the same language. If you don't know the language of the source files, or your input documents contains different source languages, select auto. Amazon Translate auto detects the source language for each input document. For a list of supported language codes, see Supported languages in the Amazon Translate Developer Guide.

Type: String

Length Constraints: Minimum length of 2. Maximum length of 5.

Required: Yes

TargetLanguageCodes

The target languages of the translation job. Enter up to 10 language codes. Each input file is translated into each target language.

Each language code is 2 or 5 characters long. For a list of language codes, see Supported languages in the Amazon Translate Developer Guide.

Type: Array of strings

Array Members: Minimum number of 1 item.

Length Constraints: Minimum length of 2. Maximum length of 5.

Required: Yes

TerminologyNames

The name of a custom terminology resource to add to the translation job. This resource lists examples source terms and the desired translation for each term.

This parameter accepts only one custom terminology resource.

If you specify multiple target languages for the job, translate uses the designated terminology for each requested target language that has an entry for the source term in the terminology file.

For a list of available custom terminology resources, use the ListTerminologies operation.

For more information, see Custom terminology in the Amazon Translate Developer Guide.

Type: Array of strings

Length Constraints: Minimum length of 1. Maximum length of 256.

Pattern: ^([A-Za-z0-9-]_?)+$

Required: No

Response Syntax

{ "JobId": "string", "JobStatus": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

JobId

The identifier generated for the job. To get the status of a job, use this ID with the DescribeTextTranslationJob operation.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 32.

Pattern: ^([\p{L}\p{Z}\p{N}_.:/=+\-%@]*)$

JobStatus

The status of the job. Possible values include:

  • SUBMITTED - The job has been received and is queued for processing.

  • IN_PROGRESS - Amazon Translate is processing the job.

  • COMPLETED - The job was successfully completed and the output is available.

  • COMPLETED_WITH_ERROR - The job was completed with errors. The errors can be analyzed in the job's output.

  • FAILED - The job did not complete. To get details, use the DescribeTextTranslationJob operation.

  • STOP_REQUESTED - The user who started the job has requested that it be stopped.

  • STOPPED - The job has been stopped.

Type: String

Valid Values: SUBMITTED | IN_PROGRESS | COMPLETED | COMPLETED_WITH_ERROR | FAILED | STOP_REQUESTED | STOPPED

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServerException

An internal server error occurred. Retry your request.

HTTP Status Code: 500

InvalidParameterValueException

The value of the parameter is not valid. Review the value of the parameter you are using to correct it, and then retry your operation.

HTTP Status Code: 400

InvalidRequestException

The request that you made is not valid. Check your request to determine why it's not valid and then retry the request.

HTTP Status Code: 400

ResourceNotFoundException

The resource you are looking for has not been found. Review the resource you're looking for and see if a different resource will accomplish your needs before retrying the revised request.

HTTP Status Code: 400

TooManyRequestsException

You have made too many requests within a short period of time. Wait for a short time and then try your request again.

HTTP Status Code: 400

UnsupportedLanguagePairException

Amazon Translate does not support translation from the language of the source text into the requested target language. For more information, see Supported languages in the Amazon Translate Developer Guide.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: