HTML Translate
Update:
Translate text containing HTML tags while preserving the original tag structure.
GET / POSThttps://translate.ilivedata.com/api/v1/htmlTranslate
Before integrating, register an account and create a company on the LiveData website. In the console, select the real-time text translation service and create an application to obtain your project ID and secret key. Additional services can be enabled from the console’s Overview page.
Request Parameters
Request Headers
Header
Value
Description
Accept
application/json;charset=UTF-8
Response format
Authorization
—
Signature calculated as described in Request Signature below
Request Fields
Parameter
Type
Required
Description
q
String
Yes
HTML text to translate. Maximum length: 256*1024.
source
String
Yes
Language of the source text. Use one of the ISO 639-1 language codes listed in Language Support, or set this parameter to auto. The API automatically detects the language and uses this value as a reference when the sentence contains only meaningless text.
target
String
Yes
Target language code. See Language Support for supported values.
appId
String
Yes
Unique identifier of the project or application. Register an account and company on the website, then create a real-time translation project in the console to obtain its appId.
profanity
String
No
Sensitive content filtering. Set to censor to enable or off to disable. Defaults to off. This feature only filters keywords. For stricter text moderation or custom requirements, use LiveData’s multilingual text moderation service.
timeStamp
String
Yes
UTC time when the request is sent, in W3C format, for example 2026-10-12T02:30:00Z. Use the current time for actual requests.
Request Example
The following example uses GET. Replace appId, timeStamp, and the signature with actual values. HTML tags in q must be URL-encoded.
GET /api/v1/htmlTranslate?q=%3Cp%3Ehello%20world%3C%2Fp%3E&source=en&target=zh-CN&appId=1234&timeStamp=2026-10-12T02%3A30%3A00Z HTTP/1.1
Host: translate.ilivedata.com
Accept: application/json;charset=UTF-8
Authorization: <calculated signature>
Request Signature
Calculate the signature using your project’s secretKey and place the result in the Authorization request header. The API returns HTTP 401 if the signature does not match or the project does not have permission.
Build the Canonicalized Query String
- Sort parameters by name.
- URL-encode parameter names and values according to RFC 3986: leave letters, digits,
-, _, ., and ~ unchanged; encode all other characters using uppercase hexadecimal percent encoding. Encode multibyte UTF-8 characters byte by byte.
- Join each parameter name and value with
= (keep = even for empty values), then join the pairs with & to obtain CanonicalizedQueryString.
When using a form URL-encoding library, replace + with %20, * with %2A, and %7E with ~ in the encoded output. Spaces must be encoded as %20.
Build the String to Sign
StringToSign = HTTPMethod + "\n" +
HostHeaderInLowercase + "\n" +
HTTPRequestURI + "\n" +
CanonicalizedQueryString
Signature Component
Value
HTTPMethod
Actual request method: GET or POST
HostHeaderInLowercase
translate.ilivedata.com
HTTPRequestURI
/api/v1/htmlTranslate
HTTPRequestURI does not include query parameters.
Calculate Authorization
Calculate the HMAC-SHA256 digest of StringToSign using secretKey as the key. Base64-encode the digest and use the result as the value of the Authorization request header.
Sample Code
For client integration examples, see Sample Code.
Translate text containing HTML tags while preserving the original tag structure.
https://translate.ilivedata.com/api/v1/htmlTranslateBefore integrating, register an account and create a company on the LiveData website. In the console, select the real-time text translation service and create an application to obtain your project ID and secret key. Additional services can be enabled from the console’s Overview page.
Request Parameters
Request Headers
| Header | Value | Description |
|---|---|---|
Accept |
application/json;charset=UTF-8 |
Response format |
Authorization |
— | Signature calculated as described in Request Signature below |
Request Fields
| Parameter | Type | Required | Description |
|---|---|---|---|
q |
String |
Yes | HTML text to translate. Maximum length: 256*1024. |
source |
String |
Yes | Language of the source text. Use one of the ISO 639-1 language codes listed in Language Support, or set this parameter to auto. The API automatically detects the language and uses this value as a reference when the sentence contains only meaningless text. |
target |
String |
Yes | Target language code. See Language Support for supported values. |
appId |
String |
Yes | Unique identifier of the project or application. Register an account and company on the website, then create a real-time translation project in the console to obtain its appId. |
profanity |
String |
No | Sensitive content filtering. Set to censor to enable or off to disable. Defaults to off. This feature only filters keywords. For stricter text moderation or custom requirements, use LiveData’s multilingual text moderation service. |
timeStamp |
String |
Yes | UTC time when the request is sent, in W3C format, for example 2026-10-12T02:30:00Z. Use the current time for actual requests. |
Request Example
The following example uses GET. Replace appId, timeStamp, and the signature with actual values. HTML tags in q must be URL-encoded.
GET /api/v1/htmlTranslate?q=%3Cp%3Ehello%20world%3C%2Fp%3E&source=en&target=zh-CN&appId=1234&timeStamp=2026-10-12T02%3A30%3A00Z HTTP/1.1
Host: translate.ilivedata.com
Accept: application/json;charset=UTF-8
Authorization: <calculated signature>
Request Signature
Calculate the signature using your project’s secretKey and place the result in the Authorization request header. The API returns HTTP 401 if the signature does not match or the project does not have permission.
Build the Canonicalized Query String
- Sort parameters by name.
- URL-encode parameter names and values according to RFC 3986: leave letters, digits,
-,_,., and~unchanged; encode all other characters using uppercase hexadecimal percent encoding. Encode multibyte UTF-8 characters byte by byte. - Join each parameter name and value with
=(keep=even for empty values), then join the pairs with&to obtainCanonicalizedQueryString.
When using a form URL-encoding library, replace + with %20, * with %2A, and %7E with ~ in the encoded output. Spaces must be encoded as %20.
Build the String to Sign
StringToSign = HTTPMethod + "\n" +
HostHeaderInLowercase + "\n" +
HTTPRequestURI + "\n" +
CanonicalizedQueryString
| Signature Component | Value |
|---|---|
HTTPMethod |
Actual request method: GET or POST |
HostHeaderInLowercase |
translate.ilivedata.com |
HTTPRequestURI |
/api/v1/htmlTranslate |
HTTPRequestURI does not include query parameters.
Calculate Authorization
Calculate the HMAC-SHA256 digest of StringToSign using secretKey as the key. Base64-encode the digest and use the result as the value of the Authorization request header.
Sample Code
For client integration examples, see Sample Code.