Pricing 
API Pricing

Try For Free Now

Dark

Light

TEXT TRANSLATION
Text Translation Sync (Real-time translation engine)
Service will wait the translation response.
To reduce the response time of speech translation, we recommend the Real-time translation engine.
If you are using other translation engine, Please refer to the "Text Translation Sync" section.
Endpoint
Request details
POST
https://translate.rozetta-api.io/api/v1/translate
Header
Header
Description
Content-Type
application/json
accessKey, nonce, signature
Please refer to the authentication section.
Body
Key
Required
Description
fieldId
O
Professional field ID. If you are using real-time translation engine, please specify it as "1"
text
O
Original text. Specify an array of the texts to be translated; each array element is up to 200 words. The total array size of the texts should be less than 270KB.(about 90 thousands Japanese characters)
sourceLang
O
The language of the original text. Except for languages such as zh-CN and zh-TW, please use the ISO 639-1 code. Specify "auto" for automatic language detection. To get the list of supported languages, please refer to Languages section.
contractId
Contract ID. For user who has one contract, the field can be omitted. For user who has two or more contracts, it's required to specify the contractId. (e.g. User who has a Text translation contract and a Speech translation contract, has to specify the contract ID)
targetLang
O
The language of the translated text. Except for languages such as zh-CN and zh-TW, please use the ISO 639-1 code. To get the list of supported languages, please refer to Languages section.
autoSplit
Specify true for splitting long text(s)(more than 1000 words) into sentences automatically. Original text(s) in English, Japanese, and Chinese (zh-CN, zh-HK, and zh-TW) can be splitted automatically now.
Response
Key
Description
status
For successful request, success will be specified for this field, otherwise failure will be specified. ※When a request contains multiple texts, even only one text is failed to translate, the entire request will be failed.
taskId
Task ID. This helps us to locate the root cause of the problem in timely manner when answering your enquiry.
translationResult
Translation results list.
sourceText
Original text.
translatedText
Translated text.

api/v1/translate
Translate "This is a pen." and "I have an apple." two sentences from English to Japanese.
Go
JavaScript
PHP
C#
VB.NET
// Define struct of request json body
type TranslateJson struct {
  FieldId string `json:"fieldId"`
  Text []string `json:"text"`
  TargetLang string `json:"targetLang"`
  SourceLang string `json:"sourceLang"`
}

// Post text and get translation results
func PostApiExample(accessKey, secretKey, basePath, nonce string) {
  translatePath := "/api/v1/translate"
    
  signTranslate := MakeHMAC(nonce, translatePath, secretKey)

  testJson := &TranslateJson{
    FieldId: "1",
    Text: []string{"This is a pen.", "I have an apple."},
    TargetLang: "ja", 
    SourceLang: "en",
    ContractId: "your contractId"}
  jsonValue, _ := json.Marshal(testJson)

  client := &http.Client{}
  req, err := http.NewRequest(
    "POST",
    GetFullUrl(basePath, translatePath),
    bytes.NewBuffer([]byte(jsonValue)),
  )
  req.Header.Set("Content-Type", "application/json")
  req.Header.Set("nonce", nonce)
  req.Header.Set("accessKey", accessKey)
  req.Header.Set("signature", signTranslate)
  res, err := client.Do(req)
    
  if err != nil {
    fmt.Printf("The HTTP request failed with error %s\n", err)
  } else {
    data, _ := ioutil.ReadAll(res.Body)
    fmt.Println(string(data))
  }
}
About the authentication, please refer to the authentication section.
You can get a full version of sample codes here
©️ 2019 Rozetta API  ・  Powered by Rozetta

Rozetta Corp.

^