👁️ OCR (Optical Character Recognition)

    This API performs OCR (Optical Character Recognition) on scanned documents. It can either translate scanned files directly or extract the recognized HTML content without translation.


    📋 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.
    scannedintYesMust be 1. Indicates the file is scanned and requires OCR
    only_extractintYes1 = Extract scanned HTML only (no translation). Must be used with scanned=1. The HTML file can be downloaded via Download File API

    Request Body

    FieldTypeRequiredDescription
    idintYesTask ID returned from Upload File API
    actionstringYes"start" to start OCR/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 (OCR Translation)

    curl -X POST "https://api.bluente.com/api/20250924/blu_translate/translate?engine=3&scanned=1" \
         -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&scanned=1", {
      method: "POST",
      headers: {
        "Authorization": "Bearer $BLUENTE_API_KEY"
      },
      body: JSON.stringify({
        id: 1,
        action: "start",
        from: "en",
        to: "zh",
        namespace: "Bluente Partner"
      })
    })

    Example (OCR Only Extract)

    curl -X POST "https://api.bluente.com/api/20250924/blu_translate/translate?engine=3&scanned=1&only_extract=1" \
         -H "Authorization: Bearer $BLUENTE_API_KEY" \
         -H "Content-Type: application/json" \
         -d '{
               "id": 1,
               "action": "start",
               "from": "en",
               "to": "zh"
             }'

    or

    fetch("https://api.bluente.com/api/20250924/blu_translate/translate?engine=3&scanned=1&only_extract=1", {
      method: "POST",
      headers: {
        "Authorization": "Bearer $BLUENTE_API_KEY"
      },
      body: JSON.stringify({
        id: 1,
        action: "start",
        from: "en",
        to: "zh"
      })
    })

    ✅ Success Response Example

    {
      "message": "success",
      "code": 0
    }

    ❌ Error Response Example

    {
      "message": "invalid scanned parameter",
      "code": 400
    }

    📌 Notes

    • scanned=1 is mandatory for OCR requests.
    • If only_extract=1, the system will only generate an OCR HTML file without translation.
    • The extracted HTML can be downloaded via the Download File API.
    • Use action=start to begin OCR or action=cancel to stop it.
    • After starting OCR, check progress using the Get Translation Status API.