Integrating and Using the Localization Translate API
The main function of the Localization Translate API is to return translated text from input text. The target language can be customized, and the translation result can be output in two popular formats: json and markdown.
This document provides detailed instructions for integrating the Translate API, helping you easily integrate and take full advantage of its powerful features. With the Translate API, you can easily translate input text into a specific language and output the translation result in a specified format.
¶ Application Process
To use the Localization Translate API, first obtain your API Token from the Ace Data Cloud Console and keep it for later use.

If you have not yet logged in or registered, you will be automatically redirected to the login page to register and log in. Once completed, you will be automatically returned to the current page.
A general application's API Key can be used for services enabled for the account; a dedicated application's Key can be used within the scope of that application's services. Please check the Key's permissions, validity period, and limits, and confirm that the application balance is sufficient to pay for this request. Available trial credits are subject to what is displayed in your account. If the balance is insufficient, click the "Recharge" button.
📘 Full documentation: Localization Translate API →
¶ Request Example
We will use an English input as an example to demonstrate how to use the API. Suppose the English text is: # Title 1\n\nThis is a paragraph.\n\n## Title 2\n\nThis is another paragraph.. The following demonstrates how to submit the English text, obtain the Chinese translation, and display it in markdown format.
¶ Set the Request Headers and Request Body
Request Headers include:
accept: Specifies that the response should be received in JSON format. Set this toapplication/json.authorization: The key used to call the API. After obtaining it, you can select it directly from the dropdown.
Request Body includes:
input: The content to be translated. Pass a string whenextension=md, or a JSON object whenextension=json.locale: The custom target language for the translation.extension: The input content format, eithermdorjson.model: The large language model used for translation. The default is gpt-3.5.
extension |
input type |
Example |
|---|---|---|
md |
string | "# Title\n\nParagraph" |
json |
object | {"title": "Hello", "button": "Submit"} |
extension must match the input type; a string cannot use json, and a JSON object cannot use md.
The settings are shown in the figure below:

¶ Code Examples
You can see that code in various languages has already been automatically generated on the right side of the page, as shown below:

Some code examples are as follows:
¶ CURL
curl -X POST 'https://api.acedata.cloud/localization/translate' \
-H 'accept: application/json' \
-H 'authorization: Bearer {token}' \
-H 'content-type: application/json' \
-d '{
"input": "# Title 1\n\nThis is a paragraph.\n\n## Title 2\n\nThis is another paragraph.",
"locale": "zh-CN",
"extension": "md"
}'
¶ Python
import requests
url = "https://api.acedata.cloud/localization/translate"
headers = {
"accept": "application/json",
"authorization": "Bearer {token}",
"content-type": "application/json"
}
payload = {
"input": "# Title 1\n\nThis is a paragraph.\n\n## Title 2\n\nThis is another paragraph.",
"locale": "zh-CN",
"extension": "md"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
¶ Response Example
After a successful request, the API will return information about the result of this translation task. For example:
{
"data": "# 标题 1\n\n这是一个段落。\n\n## 标题 2\n\n这是另一个段落。",
"usage": {
"prompt_tokens": 172,
"completion_tokens": 25
},
"model": "gpt-3.5-turbo-16k",
"locale": "zh-CN"
}
As you can see, the result contains a data field, which includes the translated Chinese text and is returned in markdown format. The other information is as follows:
data, the result of this translation task.model, the large language model used for this translation task.locale, the target language for this translation task.
¶ Error Handling
If an error occurs when calling the API, the API will return the corresponding error code and message. For example:
400 token_mismatched: Bad request, possibly due to missing or invalid parameters.400 api_not_implemented: Bad request, possibly due to missing or invalid parameters.401 invalid_token: Unauthorized, invalid or missing authorization token.429 too_many_requests: Too many requests, you have exceeded the rate limit.500 api_error: Internal server error, something went wrong on the server.
¶ Error Response Example
{
"success": false,
"error": {
"code": "api_error",
"message": "fetch failed"
},
"trace_id": "2cf86e86-22a4-46e1-ac2f-032c0f2a4e89"
}
¶ Conclusion
Through this document, you have learned how to use the Localization Translate API to easily translate input text into a specific language and output the translation result in a specified format. We hope this document helps you better integrate and use the API. If you have any questions, please feel free to contact our technical support team.
