📤 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
    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?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?engine=3", {
      method: "POST",
      headers: {
        "Authorization": "Bearer $BLUENTE_API_KEY"
      },
      body: formData
    })

    ✅ Success Response Example

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

    📊 Response Fields

    FieldTypeDescription
    messagestringResponse message, usually "success"
    codeintStatus code, 0 means success
    dataobjectMain payload
    └─ idintTask ID — used to query the translation task status
    └─ languagestringReserved. Currently always empty — language is not detected at upload time
    └─ sub_task_idsarrayOnly for multi-file uploads; null for a single file

    ❌ Error Response Example

    {
      "message": "missing file from body",
      "code": 40
    }

    See Error Codes for all codes.


    📌 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. InDesign files can be uploaded as .indd or .idml. See InDesign (INDD and IDML).
    • The filename must include its extension (e.g. report.pdf). A filename without an extension returns code: 40.
    • Upload is asynchronous. The id is returned as soon as the file is received, before the file is processed and its pages are counted. Problems with the file itself (unsupported, corrupt or password-protected files) are reported later by Get Translation Status as status ERROR.
    • Large files may take longer to process; ensure the request is sent as multipart/form-data.
    • Choose engine=3 for LLM-based translations.