🚀 Translate File
This API starts or cancels a translation task for an uploaded document. You can customize the translation with glossary, bilingual mode, and namespace options.
📋 Basic Information
- Method:
POST
- Path:
https://api.bluente.com/api/20250924/blu_translate/translate
- Authentication: Required —
Authorization: Bearer $BLUENTE_API_KEY
📝 Request Parameters
Query String
Field | Type | Required | Description |
---|---|---|---|
engine | int | Yes | Translation engine: 3 = LLM , 4 = LLM Pro . ⚠️Warning: The engine must be consistent with the task Upload File. |
glossary | int | No | 1 = Use glossary . Must be combined with custom_glossary=1 if enabled |
custom_glossary | int | No | 1 = Use custom glossary . Must be combined with glossary=1 if enabled |
bilingual | int | No | 1 = Translate file in bilingual format |
vertical_bilingual | int | No | Layout for bilingual files (1 = Top-down , 0 = Left-right ). Requires bilingual=1 |
scanned | int | No | 1 = Translate scanned document |
Engine notes:
- LLM: Transformer-based, provides more natural and contextual translations (currently supports word-level translation only).
- LLM Pro: LLM with a larger model size, providing more accurate and context-aware translations.
Request Body
Field | Type | Required | Description |
---|---|---|---|
id | int | Yes | Task ID returned from Upload File API |
action | string | Yes | "start" to start translation, "cancel" to cancel the task |
from | string | Yes | Source language code |
to | string | Yes | Target language code |
namespace | string | No | Use a specific namespace for glossary. If not set, the entire glossary is used |
💡 Example (Start Translation)
curl -X POST "https://api.bluente.com/api/20250924/blu_translate/translate?engine=3&glossary=1&custom_glossary=1&bilingual=1&vertical_bilingual=1&scanned=0" \
-H "Authorization: Bearer $BLUENTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": 1,
"action": "start",
"from": "en",
"to": "zh",
"namespace": "Bluente Partner"
}'
or
fetch("https://api.bluente.com/api/20250924/blu_translate/translate?engine=3&glossary=1&custom_glossary=1&bilingual=1&vertical_bilingual=1&scanned=0", {
method: "POST",
headers: {
"Authorization": "Bearer $BLUENTE_API_KEY"
},
body: JSON.stringify({
id: 1,
action: "start",
from: "en",
to: "zh",
namespace: "Bluente Partner"
})
})
❌ Example (Cancel Translation)
curl -X POST "https://api.bluente.com/api/20250924/blu_translate/translate" \
-H "Authorization: Bearer $BLUENTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": 1,
"action": "cancel",
"from": "en",
"to": "zh"
}'
or
fetch("https://api.bluente.com/api/20250924/blu_translate/translate", {
method: "POST",
headers: {
"Authorization": "Bearer $BLUENTE_API_KEY"
},
body: JSON.stringify({
id: 1,
action: "cancel",
from: "en",
to: "zh"
})
})
✅ Success Response Example
{
"message": "success",
"code": 0
}
❌ Error Response Example
{
"message": "invalid task id",
"code": 400
}
📌 Notes
- The
id
field must be obtained from the Upload File API. - Use
action = start
to begin translation, andaction = cancel
to stop an ongoing translation. - When using bilingual options, make sure
bilingual=1
and configurevertical_bilingual
appropriately. - After translation is started, check task status using the Get Translation Status API.
- Once translation is
READY
, download the file using the Download File API.