📊 Batch Create Custom Glossary (Upload CSV)

    This API allows you to upload a glossary file in CSV format. Each row in the file represents a glossary term mapping between source and target language.


    📋 Basic Information

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

    📝 Request Parameters (Query)

    Query String: none


    Request Body

    • Type: multipart/form-data
    {
      "file": file.csv,  // must follow the template file's format
      "namespace": "Bluente Partner" // scope for a specific client or project
    }
    FieldTypeRequiredDescription
    filefileYesCSV file to upload
    namespacestringNoNamespace for the glossary

    📎 CSV Template: Download here

    The CSV file must contain the required columns:

    • source_lang
    • source_text
    • target_lang
    • target_text

    💡 Example

    curl -X POST "https://api.bluente.com/api/20250924/blu_translate/glossary/upload" \
         -H "Authorization: Bearer $BLUENTE_API_KEY" \
         -F "file=@custom_glossary.csv" \
         -F "namespace=Bluente Partner"

    or

    fetch("https://api.bluente.com/api/20250924/blu_translate/glossary/upload", {
      method: "POST",
      headers: {
        "Authorization": "Bearer $BLUENTE_API_KEY"
      },
      body: {
        file: "/path/to/custom_glossary.csv",
        namespace: "Bluente Partner"
      }
    })

    ✅ Success Response Example

    {
      "message": "success",
      "code": 0,
      "data": [
        {
          "id": 238,
          "user_id": "",
          "organization_id": "",
          "source_lang": "English",
          "source_text": "hello",
          "target_lang": "Chinese",
          "target_text": "你好",
          "namespace": "Bluente Partner",
          "app_id": 10000,
          "updated_by": "",
          "updated_at": "2024-11-18 16:00:54",
          "created_at": "2024-11-18 16:00:54"
        },
        {
          "id": 239,
          "user_id": "",
          "organization_id": "",
          "source_lang": "English",
          "source_text": "Hi",
          "target_lang": "Chinese",
          "target_text": "你好啊",
          "namespace": "Bluente Partner",
          "app_id": 10000,
          "updated_by": "",
          "updated_at": "2024-11-18 16:01:14",
          "created_at": "2024-11-18 16:01:14"
        }
      ]
    }

    📊 Response Fields

    FieldTypeDescription
    messagestringResponse message, usually "success"
    codeintStatus code, 0 means success
    dataarrayList of glossary entries created
    data[].idintGlossary item ID
    data[].user_idstringID of the user who created the glossary
    data[].organization_idstringOrganization ID (empty if not set)
    data[].source_langstringSource language name
    data[].source_textstringSource term text
    data[].target_langstringTarget language name
    data[].target_textstringTarget term text
    data[].namespacestringNamespace (scope of glossary)
    data[].app_idintApplication ID
    data[].updated_bystringLast updater (empty if none)
    data[].updated_atstringLast update timestamp
    data[].created_atstringCreation timestamp

    ❌ Error Response Example

    {
      "message": "invalid file format",
      "code": 400
    }

    📌 Notes

    • The CSV file must strictly follow the template format; otherwise, the API will reject the upload.
    • namespace allows isolating glossaries for different clients, partners, or use cases.
    • Each successful row in the CSV will be returned in the data array with its generated id.
    • Uploading a large glossary may take longer to process.