Pricing 
API Pricing

Try For Free Now

Dark

Light

TEXT TRANSLATION
Synchronization
Service will wait the translation response.
Synchronization is applied to T-4OO engine, Real-time, and T-3MT engine.
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. Select a professional field to improve the translation accuracy. Please refer to the Specialized Fields section. When using the T-3MT engine, please refer to the「T-3MT Field」 or「mid」.
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.
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.
contractId
O
Contract ID. Specify the appropriate contract ID for the API you are using. e.g.Specify the text contract ID when using the text translation API, or specify the file contract ID when using the file translation API. You can determine which engine you are using from the contract ID.
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.
Body (only for T-4OO engine)
Key
Required
Description
removeFakeLineBreak
Only applicable when using T-4OO engine. When set to true (default), the translation engine will try to judge that if several lines of the input is actually one sentence, if it think they are, it will combine them to one sentence before translation. When set to false, the translation engine will not combine the original texts, and the texts will be translated as-is.
t4ooCategoryId
Only applicable when using T-4OO engine. Parallel translation ID. When specifying more than one IDs, concatenate them with commas. e.g. 101,252,301 If no ID is specified, parallel translation will be applied by default. (According to your fieldId) If you don't want to use parallel translation, please specify "-1". ※IDs are avaliable upon contact. ※isT4ooSplit might be necessary. Please refert to the example in isT4ooSplit.
t4ooGlossaryId
Only avaliable when using T-4OO engine. Glossary ID. When specifying more than one IDs, concatenate them with commas. e.g. 101,252,301 If no ID is specified, glossary will be applied by default. (Individual and Group) If you don't want to use glossary, please specify "-1". ※IDs are avaliable upon request.
isT4ooSplit
Only applicable when using T-4OO engine. When set to false(default), each piece of text will be translated as a single unit. If true, each piece of text will be splitted into sentences and text will be translated in units of sentence. Here in below, you can observe the differences between specifying true and false. 【Parallel translation】”That is a dog.” “対訳試験” 【An element of text】”That is a bag.That is a dog.” 【Translate result(isT4ooSplit as false)】” あれはかばんです。あれは犬です。” 【Translate result(isT4ooSplit as true)】” あれはかばんです。対訳試験”
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.
wordCount
Word counts of all original texts.
Limitation
Limitation
Only applicable when using T-4OO engine. Each key(accessKey) can only send 60 requests in 1 minute, or it will return error. When this error is happened, please send your request after 60 seconds.

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
package main

import (
  "encoding/json"
  "fmt"
  "net/http"
  "io/ioutil"
  "bytes"
  "strings"
)

type TranslateJson struct {
  FieldId string `json:"fieldId"`
  Text []string `json:"text"`
  TargetLang string `json:"targetLang"`
  SourceLang string `json:"sourceLang"`
  ContractId string `json:"contractId"`
}

// Post text and get translation results
func main() {
  url := "https://translate.rozetta-api.io/translate/api/v1/token"
  method := "POST"

  payload := strings.NewReader(`{
    "accessKey": "YOUR_ACCESS_KEY",
    "secretKey": "YOUR_SECRET_KEY",
    "duration": 10000
  }`)

  tokenClient := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")

  res, err := tokenClient.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }

  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }

  var jsondata map[string]interface{}
  json.Unmarshal([]byte(body), &jsondata)

  token := jsondata["data"].(map[string]interface{})["encodedJWT"].(string)


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

  client := &http.Client{}
  translateReq, err := http.NewRequest(
    "POST",
    "https://translate.rozetta-api.io/translate/api/v1/translate",
    bytes.NewBuffer([]byte(jsonValue)),
  )
  translateReq.Header.Set("Content-Type", "application/json")
  translateReq.Header.Set("Authorization", "Bearer " + token)
  resp, err := client.Do(translateReq)

  if err != nil {
    fmt.Printf("The HTTP request failed with error %s
", err)
  } else {
    data, _ := ioutil.ReadAll(resp.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.

^