DocsTranslation APITranslate file

    🚀 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

    FieldTypeRequiredDescription
    engineintYesTranslation engine: 3 = LLM, 4 = LLM Pro. ⚠️Warning: The engine must be consistent with the task Upload File.
    glossaryintNo1 = Use glossary. Must be combined with custom_glossary=1 if enabled
    custom_glossaryintNo1 = Use custom glossary. Must be combined with glossary=1 if enabled
    bilingualintNo1 = Translate file in bilingual format
    vertical_bilingualintNoLayout for bilingual files (1 = Top-down, 0 = Left-right). Requires bilingual=1
    scannedintNo1 = 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

    FieldTypeRequiredDescription
    idintYesTask ID returned from Upload File API
    actionstringYes"start" to start translation, "cancel" to cancel the task
    fromstringYesSource language code
    tostringYesTarget language code
    namespacestringNoUse 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, and action = cancel to stop an ongoing translation.
    • When using bilingual options, make sure bilingual=1 and configure vertical_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.