👁️ 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
Field | Type | Required | Description |
---|---|---|---|
engine | int | Yes | Translation engine: 3 = LLM , 4 = LLM Pro . ⚠️Warning: The engine must be consistent with the task Upload File. |
scanned | int | Yes | Must be 1 . Indicates the file is scanned and requires OCR |
only_extract | int | Yes | 1 = Extract scanned HTML only (no translation) . Must be used with scanned=1 . The HTML file can be downloaded via Download File API |
Request Body
Field | Type | Required | Description |
---|---|---|---|
id | int | Yes | Task ID returned from Upload File API |
action | string | Yes | "start" to start OCR/translation, "cancel" to cancel the task |
from | string | Yes | Source language code |
to | string | Yes | Target language code |
namespace | string | No | Use 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 oraction=cancel
to stop it. - After starting OCR, check progress using the Get Translation Status API.