The Doctranslate document translation platform provides programmatic access to document translation for formats including DOCX, PDF, PPTX, and XLSX via standard HTTP endpoints. Full technical references are maintained in the Doctranslate API Documentation .
Technical Requirements for English to Bangla Document Translation
Automating English to Bangla document workflows requires accounting for script characteristics and structural document constraints:
- Complex Script Rendering: Bangla uses conjunct characters (যুক্তবর্ণ - juktoborno) and dependent vowel signs (kar and fola) requiring Unicode font shaping engines. Text extractors without proper font mapping can split conjunct sequences.
- Left-to-Right Text Alignment: Both English and Bangla follow a left-to-right (LTR) reading direction. When integrating automated translation into formatted files, layout engines must handle variable text bounds across table cells and defined blocks.
- Tabular and Columnar Structure: Business documents such as financial statements and operational agreements rely on table columns and alignment. Processing files as structured documents rather than fragmented strings preserves table structures.
API Endpoint Specifications
The translation service provides endpoints for single-file and batch document workflows. Official documentation for document translation endpoints is available at Document Translation API v2 and Document Translation API v3 .
Endpoint: POST /v2/translate/document
- Documentation URL: https://developer.doctranslate.io/document-translation-api/translation-api/api-v2/document-translation.md
- Base Endpoint: https://api-doc.doctranslate.io
- HTTP Method: POST
- Path: /v2/translate/document
- Authentication: OAuth2PasswordBearer (
Authorization: Bearer <your_api_token>orX-API-Key: <your_api_key>) - Request Body Type: multipart/form-data
The endpoint accepts the following parameters:
| Parameter | Type | Required | Values and Description |
|---|---|---|---|
file | File | Yes | Document file upload. Supported formats: DOCX, PDF, PPTX, XLSX. |
file_type | String | Yes | File extension string: DOCX, PDF, PPTX, XLSX. |
original_lang | String | No | Source language code (e.g., en). |
dest_lang | String | Yes | Target language code (bn for Bangla). |
process_mode | String | No | Output processing mode: replace (replaces source text), append (bilingual output), append_reverse. |
style_mode | Integer | No | Styling preference for translation output (Default: 0). Influences formatting and presentation. |
translate_type | String | No | Translation engine version: Paraphrase, Professional. |
is_translate_images | Bool | No | Boolean flag indicating whether images within the document should also be translated. |
tone | String | No | Tone of the translation. |
domain | String | No | Domain specialization to assist model selection (e.g., legal, finance). |
bilingual_text_style__font | String | No | Font name used when process_mode=append. |
bilingual_text_style__color | String | No | Color value used when process_mode=append. |
dictionary | String | No | Custom dictionary in JSON format specifying word-level translations. |
custom_prompt | String | No | Custom prompt instructions passed to the translation engine. |
Endpoint: POST /v3/process (Batch File Translation)
- Documentation URL: https://developer.doctranslate.io/document-translation-api/translation-api/api-v3/translate-multiple-files-currently-supports-document-summarization.md
- HTTP Method: POST
- Path: /v3/process
- Request Body Type: application/json
- Parameters: Accepts
task_type(document,images,audio,video,summarization,create_video),meta_files(array containing uploaded file metadata and task identifiers),dest_lang,process_mode,translate_type,dictionary, andoutput_format.
Polling and Result Retrieval: GET /v3/result/{task_id}
- Documentation URL: https://developer.doctranslate.io/document-translation-api/translation-api/api-v3/get-result.md
- HTTP Method: GET
- Path: /v3/result/{task_id}
- Authentication:
Authorization: Bearer <your_api_token>orX-API-Key: <your_api_key>
Document Translation Response Schema
Submitting a document to /v2/translate/document or /v3/translate/document returns:
{
"status_code": 200,
"content": {
"data": {
"task_id": "0d05c89e6f2c472ab86b291516e8e466"
},
"errors": [],
"error_description": "",
"start_time": "2024-03-11 13:05:42.080757",
"end_time": "2024-03-11 13:05:42.348086",
"status": "success"
}
} Polling Result Response Schema
Calling GET /v3/result/{task_id} returns job progress and output metadata:
{
"status_code": 200,
"content": {
"data": {
"0d05c89e6f2c472ab86b291516e8e466": {
"task_id": "0d05c89e6f2c472ab86b291516e8e466",
"url_download": "https://media.doctranslate.io/output/docx/document_bn.docx",
"type": "document",
"status": "done",
"file_name": "document_bn.docx",
"dest_lang": "bn",
"translation_type": "Document"
}
},
"errors": [],
"error_description": "",
"status": "success"
}
} Configuring Custom Terminology Dictionaries
For specialized technical, corporate, or financial documentation, developers can enforce word-level translation mappings via the dictionary parameter. In the single-document endpoint, the parameter takes a serialized JSON string or object mapping source terms to target terms:
{
"balance sheet": "উদ্বৃত্তপত্র",
"cash flow": "নগদ प्रवाह",
"operating income": "পরিচালন আয়"
} Note on language verification: The English-to-Bangla financial terms above are sample translations and have not yet been independently verified by a native Bangla linguist; project teams should have translations reviewed by local language specialists before production deployment.
Supported File Formats
The translation API processes core document file extensions:
- Microsoft Word (.docx): Translates paragraphs, headers, and embedded tables.
- Adobe PDF (.pdf): Translates digital PDFs and scanned documents via optical character recognition (OCR), supporting output formatting configurations detailed in API v3 specifications.
- Microsoft Excel (.xlsx): Translates cell text across worksheets while retaining tabular cell arrangements.
- Microsoft PowerPoint (.pptx): Translates text blocks across slide presentations.
File processing on the web interface accommodates up to 3 files and 300 MB total per upload. API account limits and quota specifications are detailed in the System Requirement documentation.
Output Processing Modes and Error Handling
The API provides granular control over bilingual file generation through the process_mode parameter:
replace: Replaces the source English text entirely with the translated Bangla output while maintaining container coordinates.append: Appends the translated Bangla text directly beneath the original English segment, generating a bilingual comparison document. Developers can configure font family and color using `bilingual_text_stylefontandbilingual_text_stylecolor`.append_reverse: Places the translated Bangla text first, followed by the original English reference text.
When error states occur during document processing, the API returns structured error payloads:
- HTTP 400 Bad Request: Returned if the uploaded document payload cannot be processed or if required parameters are missing. The response body contains an
errorsarray and anerror_descriptionclarifying the parsing issue. - HTTP 401 Authentication Error: Returned when the request lacks a valid bearer token or when the API key provided in headers is invalid, returning
{"detail": "Not authenticated"}.
Implementation Workflow and Python Integration
Integrating the API into a document localization workflow involves three steps: submitting the multipart file payload, polling the task result endpoint until processing completes, and downloading the output file from the returned storage URL.
The following Python script illustrates submitting a DOCX file for English to Bangla translation with polling and timeout safeguards:
import time
import requests
API_BASE = "https://api-doc.doctranslate.io"
API_TOKEN = "your_api_token_here"
headers = {
"Authorization": f"Bearer {API_TOKEN}"
}
with open("annual_report_en.docx", "rb") as f:
files = {
"file": ("annual_report_en.docx", f, "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
}
data = {
"file_type": "DOCX",
"original_lang": "en",
"dest_lang": "bn",
"process_mode": "replace",
"translate_type": "Professional"
}
response = requests.post(f"{API_BASE}/v2/translate/document", headers=headers, files=files, data=data)
response.raise_for_status()
payload = response.json()
task_id = payload.get("content", {}).get("data", {}).get("task_id")
if not task_id:
raise ValueError("No task_id returned from API")
# Polling safeguard with timeout and maximum attempt limits
max_attempts = 60
poll_interval_seconds = 5
download_url = None
for attempt in range(max_attempts):
time.sleep(poll_interval_seconds)
poll_resp = requests.get(f"{API_BASE}/v3/result/{task_id}", headers=headers)
poll_resp.raise_for_status()
content = poll_resp.json().get("content", {})
task_data = content.get("data", {}).get(task_id, {})
status = task_data.get("status")
if status == "done":
download_url = task_data.get("url_download")
break
elif status == "failed":
raise RuntimeError(f"Translation task {task_id} failed.")
if download_url:
print(f"Translation finished. Download URL: {download_url}")
else:
print("Polling timed out before document translation completed.") Teams evaluating document workflows can test translation and layouts directly on Doctranslate Document Translation before automating integration via developer endpoints.
Discussion
No comments yet