Batch Translation Service Introduction —— V1

Batch Translation API

Domain:
https://translate.ilivedata.com

Path:
POST /api/v1/batchTranslate

Description:
Primarily used for translating multiple pieces of text in bulk.

Request Headers:

Header Value Description
Content-Type application/json;charset=UTF-8 Type of the request body
Accept application/json;charset=UTF-8 Expected response type
X-AppId e.g., 1234 Unique identifier for the project or application
X-TimeStamp e.g., 2024-07-01T07:59:59Z UTC timestamp in W3C format, e.g., 2024-07-01T07:59:59Z
Authorization e.g., Njl86M/jY6zZaZoGhZdGO+GI/8+yGFECusGH1234567= Signature

Request Body:

Parameter Required Type Description
contents Yes List List of content to translate, up to a maximum of 30 requests

contents:

Parameter Required Description
q Yes Original text to translate. UTF-8 encoded string, max 1024 characters.
target Yes Target language code in ISO 639-1 format.
source No Source language code in ISO 639-1 format. If omitted or invalid, language detection will be used.
profanity No Profanity filter. Values: censor or off. Defaults to off. For stricter filtering, consider the cloud moderation service.
fromId No Sender ID of the text. Required when using contextual translation model.
toId No Receiver ID of the text.
id No Unique identifier for the translation result.

Request Example:

curl -X POST --location "https://translate.ilivedata.com/api/v1/batchTranslate" \
    -H "Host: translate.ilivedata.com" \
    -H "Authorization: Njl86M/jY6zZaZoGhZdGO+GI/8+yGFECusGH1234567=" \
    -H "X-AppId: 1234" \
    -H "X-TimeStamp: 2025-01-09T16:10:59Z" \
    -H "Content-Type: application/json;charset=UTF-8" \
    -d '{
        	"contents": [
        	  {
        	    "q": "hello world!",
        	    "target": "zh-CN"
        	  }
        	]
        }'

Response Format:

Response is a JSON array. Field descriptions are as follows:

Field Type Description
errorCode Number Error code, 0 for success
errorMessage String Error message
translation Object Translation result

translation structure:

Field Type Description
id String Unique ID of the input
source String Source language code
target String Target language code
sourceText String Original text
targetText String Translated text

HTTP Response Example:

[
  {
    "errorCode": 0,
    "translation": {
      "source": "en",
      "target": "zh-CN",
      "sourceText": "hello world!",
      "targetText": "你好世界!"
    }
  }
]