📤 Upload File

    This API uploads a document for translation. Depending on the engine parameter, the request will be routed to either the LLM (Large Language Model) engine.


    📋 Basic Information

    • Method: POST
    • Path: https://api.bluente.com/api/20250924/blu_translate/upload
    • Authentication: Required — Authorization: Bearer $BLUENTE_API_KEY

    📝 Request Parameters

    Query String

    FieldTypeRequiredDescription
    glossarystringNoGlossary option, "0" by default
    engineintYesTranslation engine: 3 = LLM, 4 = LLM Pro

    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 (Form Data)

    FieldTypeRequiredDescription
    filefileYesThe file to upload

    💡 Example

    curl -X POST "https://api.bluente.com/api/20250924/blu_translate/upload?glossary=0&engine=3" \
         -H "Authorization: Bearer $BLUENTE_API_KEY" \
         -F "file=@/path/to/document.pdf"

    or

    const formData = new FormData();
    formData.append("file", fileInput.files[0]);
     
    fetch("https://api.bluente.com/api/20250924/blu_translate/upload?glossary=0&engine=3", {
      method: "POST",
      headers: {
        "Authorization": "Bearer $BLUENTE_API_KEY"
      },
      body: formData
    })

    ✅ Success Response Example

    {
      "message": "success",
      "code": 0,
      "data": {
        "id": 1,
        "language": "en"
      }
    }

    📊 Response Fields

    FieldTypeDescription
    messagestringResponse message, usually "success"
    codeintStatus code, 0 means success
    dataobjectMain payload
    └─ idintTask ID — used to query the translation task status
    └─ languagestringDetected language of the uploaded document (may be empty if detection fails)

    ❌ Error Response Example

    {
      "message": "file upload failed",
      "code": 400
    }

    📌 Notes

    • The returned id should be used in the Query Translation Status API.
    • File type must be supported by the Get Supported File Types API.
    • Large files may take longer to process; ensure the request is sent as multipart/form-data.
    • Choose engine=3 for LLM-based translations.