Text translation

Prev Next

Available in Classic and VPC

Translate and output entered text. The output results can be supplemented with glossary, honorific translation, and term replacement options.

Request

This section describes the request format. The method and URI are as follows:

Method URI
POST /translation

Request headers

For information about the headers common to all Papago Translation APIs, see Common Papago Translation headers.

Request body

You can include the following data in the body of your request:

Field Type Required Description
source String Required Language code of the source text (source)
  • auto (automatic language detection) | ko (Korean) | en (English) | ja(Japanese) | zh-CN (Chinese (Simplified)) | zh-TW (Chinese (Traditional)) | vi (Vietnamese) | th (Thai) | id (Indonesian) | fr (French) | es (Spanish) | ru (Russian) | de (German) | it (Italian)
target String Required Language code of the target text
  • ko (Korean) | en (English) | ja (Japanese) | zh-CN (Chinese (Simplified)) | zh-TW (Chinese (Traditional)) | vi (Vietnamese) | th (Thai) | id (Indonesian) | fr (French) | es (Spanish) | ru (Russian) | de (German) | it (Italian)
  • For information about language pairs for which translation is supported, see Languages supported for translation.
text String Required Text to translate
  • Up to 5000 characters translatable per call
glossaryKey String Optional Glossary ID
  • Customized translation is applied based on the glossary data.
  • Korean ⇔ English, Japanese, Chinese (Simplified/Traditional), French | English ⇔ Japanese, Chinese (Simplified/Traditional), Vietnamese, Thai, Indonesian, French | Japanese ⇔ Chinese (Simplified/Traditional)
  • When used concurrently with replaceInfo, replaceInfo has higher priority.
  • honorific is not applied to terms in glossaries.
replaceInfo String Optional Substitution translation index
  • Bulk translate specific index (str) to desired text.
    • Return original text if str is not set.
  • Korean ⇔ English, Japanese, Chinese (Simplified/Traditional), French | English ⇔ Japanese, Chinese (Simplified/Traditional), Vietnamese, Thai, Indonesian, French | Japanese ⇔ Chinese (Simplified/Traditional)
honorific Boolean Optional Whether to apply honorifics
  • true | false (default)
    • true: Apply honorifics
    • false: No honorifics
  • English ⇒ Korean, Japanese ⇒ Korean, Chinese (Simplified/Traditional) ⇒ Korean, Korean ⇒ Japanese, English ⇒ Japanese, Chinese (Simplified/Traditional) ⇒ Japanese
Note

You can also specify text that should not be translated with HTML <span> tags as follows:

<span translate="no"> </span> or <span class="notranslate"> </span>

When using tags, they do not count towards the character count and have the same supported languages as glossaryKey and replaceInfo. See Text Translation examples for examples of using the <span> tag.

Languages supported for translation

The following describes the supported languages for translation.

Supported language Translation direction Supported language
ko (Korean) en (English), ja (Japanese), zh-CN (Chinese (Simplified)), zh-TW (Chinese (Traditional)), vi (Vietnamese), th (Thai), id (Indonesian), fr (French), es (Spanish), ru (Russian), de (German), it (Italian)
en (English) ko (Korean), ja (Japanese), zh-CN (Chinese (Simplified)), zh-TW (Chinese (Traditional)), vi (Vietnamese), th (Thai), id (Indonesian), fr (French), es (Spanish), ru (Russian), de (German)
ja (Japanese) zh-CN (Chinese (Simplified)), zh-TW (Chinese (Traditional)), vi (Vietnamese), th (Thai), id (Indonesian), fr (French)
zh-CN (Chinese (Simplified)) zh-TW (Chinese (Simplified))

Request example

The request example is as follows:

If Content-Type: application/x-www-form-urlencoded

The following is a sample request when the request header Content-Type is application/x-www-form-urlencoded.

curl --location --request POST
'https://papago.apigw.ntruss.com/nmt/v1/translation' \
--header 'X-NCP-APIGW-API-KEY-ID: {Client ID issued when registering the app}' \
--header 'X-NCP-APIGW-API-KEY: {Client secret issued when registering the app}' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'source=auto' \
--data-urlencode 'target=en' \
--data-urlencode 'text=Hello, I like to eat apples while riding my bike.'

For Content-Type: application/json

The request example if the request header's Content-Type is application/json is as follows:

curl --location --request POST
'https://papago.apigw.ntruss.com/nmt/v1/translation' \
--header 'X-NCP-APIGW-API-KEY-ID: {Client ID issued when registering the app}' \
--header 'X-NCP-APIGW-API-KEY: {Client secret issued when registering the app}' \
--header 'Content-Type: application/json' \
--data '{
    "source": "auto",
    "target": "ko",
    "text": "Advanced technology requires numerous beta tests and feedbacks. This process takes up a lot of time, but it must be done for development.",
    "glossaryKey": "{glossaryKey}",
    "replaceInfo": " ",
    "honorific": "true"
}'

Response

This section describes the response format.

Response body

The response body includes the following data:

Field Type Required Description
message Object - Response result
message.result Object - Translation result details
message.result.srcLangType String - Source text language code
message.result.tarLangType String - Translated text language code
message.result.translatedText String - Translated text

Response status codes

For information about the HTTP status codes common to all Papago Translation APIs, see Common Papago Translation response status codes.

Response example

The response example is as follows:

{
    "message": {
        "result": {
            "srcLangType": "ko",
            "tarLangType": "en",
            "translatedText": "Hello, I like to eat apple while riding a bicycle."
        }
    }
}